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() {