@Inject public IndicesQueriesRegistry(Settings settings, Set<QueryParser> injectedQueryParsers) { super(settings); Map<String, QueryParser> queryParsers = Maps.newHashMap(); for (QueryParser queryParser : injectedQueryParsers) { for (String name : queryParser.names()) { queryParsers.put(name, queryParser); } } this.queryParsers = ImmutableMap.copyOf(queryParsers); }
/** * Returns all the registered query parsers */ public ImmutableMap<String, QueryParser> queryParsers() { return queryParsers; }
/** * Specification of custom {@link Query}. * * @param name holds the names by which this query might be parsed. The {@link ParseField#getPreferredName()} is special as it * is the name by under which the reader is registered. So it is the name that the query should use as its * {@link NamedWriteable#getWriteableName()} too. * @param reader the reader registered for this query's builder. Typically a reference to a constructor that takes a * {@link StreamInput} * @param parser the parser the reads the query builder from xcontent */ public QuerySpec(ParseField name, Writeable.Reader<T> reader, QueryParser<T> parser) { super(name, reader, parser); }
/** * Specification of custom {@link Query}. * * @param name the name by which this query might be parsed or deserialized. Make sure that the query builder returns this name for * {@link NamedWriteable#getWriteableName()}. * @param reader the reader registered for this query's builder. Typically a reference to a constructor that takes a * {@link StreamInput} * @param parser the parser the reads the query builder from xcontent */ public QuerySpec(String name, Writeable.Reader<T> reader, QueryParser<T> parser) { super(name, reader, parser); }