From d349de71aafbaf7734a43e673aaecc9cc94b94c4 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Thu, 7 Apr 2016 19:31:47 -0400 Subject: [PATCH] Remove registerQueryParser We've fully cut over to registerQuery! --- .../elasticsearch/search/SearchModule.java | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/search/SearchModule.java b/core/src/main/java/org/elasticsearch/search/SearchModule.java index 448f2dede8c..87fd105c404 100644 --- a/core/src/main/java/org/elasticsearch/search/SearchModule.java +++ b/core/src/main/java/org/elasticsearch/search/SearchModule.java @@ -335,28 +335,16 @@ public class SearchModule extends AbstractModule { */ public > void registerQuery(Writeable.Reader reader, QueryParser queryParser, ParseField queryName) { - innerRegisterQueryParser(queryParser, queryName); - namedWriteableRegistry.register(QueryBuilder.class, queryName.getPreferredName(), reader); - } - - /** - * Register a query via its parser's prototype. - * TODO remove this in favor of registerQuery and merge innerRegisterQueryParser into registerQuery - */ - public void registerQueryParser(QueryParser queryParser, ParseField queryName) { - innerRegisterQueryParser(queryParser, queryName); - namedWriteableRegistry.registerPrototype(QueryBuilder.class, queryParser.getBuilderPrototype()); - } - - private > void innerRegisterQueryParser(QueryParser parser, ParseField queryName) { - Tuple> parseFieldQueryParserTuple = new Tuple<>(queryName, parser); + Tuple> parseFieldQueryParserTuple = new Tuple<>(queryName, queryParser); for (String name: queryName.getAllNamesIncludedDeprecated()) { Tuple> previousValue = queryParsers.putIfAbsent(name, parseFieldQueryParserTuple); if (previousValue != null) { throw new IllegalArgumentException("Query parser [" + previousValue.v2() + "] already registered for name [" + - name + "] while trying to register [" + parser + "]"); + name + "] while trying to register [" + queryParser + "]"); } } + + namedWriteableRegistry.register(QueryBuilder.class, queryName.getPreferredName(), reader); } Set getRegisteredQueries() {