public final class SimpleSearchQueryParser extends Object
String
s into SearchQuery
implementations
according to the SearchQueryInterpreter
provided at construction
time and returns a BooleanQueryFactory
.
Strings are split into tokens separated by commas or whitespace. They
are inserted into a BooleanQueryFactory
based on the token
preceding them, which are InclusionCriteria
implementations.
Constructor and Description |
---|
SimpleSearchQueryParser(SearchQueryInterpreter interpreter)
Constructs a new parser using the specified
SearchQueryInterpreter to transform string tokens into
SearchQuery implementations. |
SimpleSearchQueryParser(SearchQueryInterpreter interpreter,
InclusionCriteria defaultInclusionCriteria)
Constructs a new parser using the specified
SearchQueryInterpreter to transform string tokens into
SearchQuery implementations and using the specified
InclusionCriteria as the default criteria
for untagged tokens. |
Modifier and Type | Method and Description |
---|---|
BooleanQueryFactory |
parse(String query)
Parses the specified
String into a
BooleanQueryFactory implementation according to the rules
specified by the SearchQueryInterpreter . |
void |
setDefaultInclusionCriteria(InclusionCriteria criteria)
Sets which
InclusionCriteria should be applied to a value
in the absence of a specific token. |
public SimpleSearchQueryParser(SearchQueryInterpreter interpreter)
SearchQueryInterpreter
to transform string tokens into
SearchQuery
implementations. The default
InclusionCriteria
is ANY.interpreter
- the SearchQueryInterpreter
implementation to usepublic SimpleSearchQueryParser(SearchQueryInterpreter interpreter, InclusionCriteria defaultInclusionCriteria)
SearchQueryInterpreter
to transform string tokens into
SearchQuery
implementations and using the specified
InclusionCriteria
as the default criteria
for untagged tokens.interpreter
- the SearchQueryInterpreter
implementation to usedefaultInclusionCriteria
- the default
InclusionCriteria
for untagged tokenspublic void setDefaultInclusionCriteria(InclusionCriteria criteria)
InclusionCriteria
should be applied to a value
in the absence of a specific token.criteria
- the default InclusionCriteria
value to usepublic BooleanQueryFactory parse(String query) throws SearchQueryParserException
String
into a
BooleanQueryFactory
implementation according to the rules
specified by the SearchQueryInterpreter
.query
- the String
to parseBooleanQueryFactory
corresponding to the StringSearchQueryParserException
- if an error occurs during parsingCopyright © 2003–2018 Atlassian. All rights reserved.