Query refactoring: simplified generic types in IndicesQueriesRegistry and IndexQueryParseService
This commit is contained in:
parent
babfea0ab7
commit
c797445457
|
@ -118,7 +118,7 @@ public class IndexQueryParserService extends AbstractIndexComponent {
|
|||
|
||||
//norelease we might want to get rid of this as it was temporarily introduced for our default doToQuery impl
|
||||
//seems to be used only in tests
|
||||
public QueryParser<? extends QueryBuilder<? extends QueryBuilder>> queryParser(String name) {
|
||||
public QueryParser<?> queryParser(String name) {
|
||||
return indicesQueriesRegistry.queryParsers().get(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,13 +35,13 @@ import java.util.Set;
|
|||
|
||||
public class IndicesQueriesRegistry extends AbstractComponent {
|
||||
|
||||
private ImmutableMap<String, QueryParser<? extends QueryBuilder<? extends QueryBuilder>>> queryParsers;
|
||||
private ImmutableMap<String, QueryParser<?>> queryParsers;
|
||||
|
||||
@Inject
|
||||
public IndicesQueriesRegistry(Settings settings, Set<QueryParser<? extends QueryBuilder<? extends QueryBuilder>>> injectedQueryParsers, NamedWriteableRegistry namedWriteableRegistry) {
|
||||
public IndicesQueriesRegistry(Settings settings, Set<QueryParser<?>> injectedQueryParsers, NamedWriteableRegistry namedWriteableRegistry) {
|
||||
super(settings);
|
||||
Map<String, QueryParser<? extends QueryBuilder<? extends QueryBuilder>>> queryParsers = Maps.newHashMap();
|
||||
for (QueryParser<? extends QueryBuilder<? extends QueryBuilder>> queryParser : injectedQueryParsers) {
|
||||
Map<String, QueryParser<?>> queryParsers = Maps.newHashMap();
|
||||
for (QueryParser<?> queryParser : injectedQueryParsers) {
|
||||
for (String name : queryParser.names()) {
|
||||
queryParsers.put(name, queryParser);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class IndicesQueriesRegistry extends AbstractComponent {
|
|||
/**
|
||||
* Returns all the registered query parsers
|
||||
*/
|
||||
public ImmutableMap<String, QueryParser<? extends QueryBuilder<? extends QueryBuilder>>> queryParsers() {
|
||||
public ImmutableMap<String, QueryParser<?>> queryParsers() {
|
||||
return queryParsers;
|
||||
}
|
||||
}
|
|
@ -307,7 +307,7 @@ public abstract class BaseQueryTestCase<QB extends AbstractQueryBuilder<QB>> ext
|
|||
try (BytesStreamOutput output = new BytesStreamOutput()) {
|
||||
testQuery.writeTo(output);
|
||||
try (StreamInput in = new NamedWriteableAwareStreamInput(StreamInput.wrap(output.bytes()), namedWriteableRegistry)) {
|
||||
QueryBuilder<? extends QueryBuilder> prototype = queryParserService.queryParser(testQuery.getWriteableName()).getBuilderPrototype();
|
||||
QueryBuilder<?> prototype = queryParserService.queryParser(testQuery.getWriteableName()).getBuilderPrototype();
|
||||
QueryBuilder deserializedQuery = prototype.readFrom(in);
|
||||
assertEquals(deserializedQuery, testQuery);
|
||||
assertEquals(deserializedQuery.hashCode(), testQuery.hashCode());
|
||||
|
|
Loading…
Reference in New Issue