|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.queryParser.core.QueryParserHelper
public class QueryParserHelper
This class is a helper for the query parser framework, it does all the three query parser phrases at once: text parsing, query processing and query building.
It contains methods that allows the user to change the implementation used on the three phases.
QueryNodeProcessor
,
SyntaxParser
,
QueryBuilder
,
QueryConfigHandler
Constructor Summary | |
---|---|
QueryParserHelper(QueryConfigHandler queryConfigHandler,
SyntaxParser syntaxParser,
QueryNodeProcessor processor,
QueryBuilder builder)
Creates a query parser helper object using the specified configuration, text parser, processor and builder. |
Method Summary | |
---|---|
QueryBuilder |
getQueryBuilder()
Returns the query builder used to build a object from the query node tree. |
QueryConfigHandler |
getQueryConfigHandler()
Returns the query configuration handler, which is used during the query node tree processing. |
QueryNodeProcessor |
getQueryNodeProcessor()
Returns the processor object used to process the query node tree, it returns null if no processor is used. |
SyntaxParser |
getSyntaxParser()
Returns the text parser used to build a query node tree from a query string. |
Object |
parse(String query,
String defaultField)
Parses a query string to an object, usually some query object. |
void |
setQueryBuilder(QueryBuilder queryBuilder)
The query builder that will be used to build an object from the query node tree. |
void |
setQueryConfigHandler(QueryConfigHandler config)
Sets the query configuration handler that will be used during query processing. |
void |
setQueryNodeProcessor(QueryNodeProcessor processor)
Sets the processor that will be used to process the query node tree. |
void |
setSyntaxParser(SyntaxParser syntaxParser)
Sets the text parser that will be used to parse the query string, it cannot be null . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueryParserHelper(QueryConfigHandler queryConfigHandler, SyntaxParser syntaxParser, QueryNodeProcessor processor, QueryBuilder builder)
queryConfigHandler
- the query configuration handler that will be initially set to this
helpersyntaxParser
- the text parser that will be initially set to this helperprocessor
- the query processor that will be initially set to this helperbuilder
- the query builder that will be initially set to this helperQueryNodeProcessor
,
SyntaxParser
,
QueryBuilder
,
QueryConfigHandler
Method Detail |
---|
public QueryNodeProcessor getQueryNodeProcessor()
null
if no processor is used.
null
if no processor is usedQueryNodeProcessor
,
setQueryNodeProcessor(QueryNodeProcessor)
public void setQueryNodeProcessor(QueryNodeProcessor processor)
QueryConfigHandler
returned by
getQueryConfigHandler()
, it will be set on the processor. The
argument can be null
, which means that no processor will be
used to process the query node tree.
processor
- the processor that will be used to process the query node tree,
this argument can be null
getQueryNodeProcessor()
,
QueryNodeProcessor
public void setSyntaxParser(SyntaxParser syntaxParser)
null
.
syntaxParser
- the text parser that will be used to parse the query stringgetSyntaxParser()
,
SyntaxParser
public void setQueryBuilder(QueryBuilder queryBuilder)
null
.
queryBuilder
- the query builder used to build something from the query node treegetQueryBuilder()
,
QueryBuilder
public QueryConfigHandler getQueryConfigHandler()
null
.
null
if not query configuration handler is definedQueryConfigHandler
,
setQueryConfigHandler(QueryConfigHandler)
public QueryBuilder getQueryBuilder()
parse(String, String)
.
setQueryBuilder(QueryBuilder)
,
QueryBuilder
public SyntaxParser getSyntaxParser()
SyntaxParser
.
SyntaxParser
,
setSyntaxParser(SyntaxParser)
public void setQueryConfigHandler(QueryConfigHandler config)
null
. It's also set to the processor
returned by getQueryNodeProcessor()
.
config
- the query configuration handler used during query processing, it
can be null
getQueryConfigHandler()
,
QueryConfigHandler
public Object parse(String query, String defaultField) throws QueryNodeException
getSyntaxParser()
, the result is a query
node tree getQueryNodeProcessor()
getQueryBuilder()
query
- the query stringdefaultField
- the default field used by the text parser
QueryNodeException
- if something wrong happens along the three phases
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |