Remove registerQueryParser

We've fully cut over to registerQuery!
This commit is contained in:
Nik Everett 2016-04-07 19:31:47 -04:00
parent 0d8e399781
commit d349de71aa
1 changed files with 4 additions and 16 deletions

View File

@ -335,28 +335,16 @@ public class SearchModule extends AbstractModule {
*/
public <QB extends QueryBuilder<QB>> void registerQuery(Writeable.Reader<QB> reader, QueryParser<QB> 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 <QB extends QueryBuilder<QB>> void innerRegisterQueryParser(QueryParser<QB> parser, ParseField queryName) {
Tuple<ParseField, QueryParser<?>> parseFieldQueryParserTuple = new Tuple<>(queryName, parser);
Tuple<ParseField, QueryParser<?>> parseFieldQueryParserTuple = new Tuple<>(queryName, queryParser);
for (String name: queryName.getAllNamesIncludedDeprecated()) {
Tuple<ParseField, QueryParser<?>> 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<String> getRegisteredQueries() {