use of org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessor in project lucene-solr by apache.
the class QueryParserHelper method parse.
/**
* Parses a query string to an object, usually some query object.<br>
* <br>
* In this method the three phases are executed: <br>
* <br>
* 1st - the query string is parsed using the
* text parser returned by {@link #getSyntaxParser()}, the result is a query
* node tree <br>
* <br>
* 2nd - the query node tree is processed by the
* processor returned by {@link #getQueryNodeProcessor()} <br>
* <br>
* 3th - a object is built from the query node
* tree using the builder returned by {@link #getQueryBuilder()}
*
* @param query
* the query string
* @param defaultField
* the default field used by the text parser
*
* @return the object built from the query
*
* @throws QueryNodeException
* if something wrong happens along the three phases
*/
public Object parse(String query, String defaultField) throws QueryNodeException {
QueryNode queryTree = getSyntaxParser().parse(query, defaultField);
QueryNodeProcessor processor = getQueryNodeProcessor();
if (processor != null) {
queryTree = processor.process(queryTree);
}
return getQueryBuilder().build(queryTree);
}
use of org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessor in project lucene-solr by apache.
the class QueryParserHelper method setQueryConfigHandler.
/**
* Sets the query configuration handler that will be used during query
* processing. It can be <code>null</code>. It's also set to the processor
* returned by {@link #getQueryNodeProcessor()}.
*
* @param config
* the query configuration handler used during query processing, it
* can be <code>null</code>
*
* @see #getQueryConfigHandler()
* @see QueryConfigHandler
*/
public void setQueryConfigHandler(QueryConfigHandler config) {
this.config = config;
QueryNodeProcessor processor = getQueryNodeProcessor();
if (processor != null) {
processor.setQueryConfigHandler(config);
}
}
Aggregations