Class SimpleSearchQueryParser
java.lang.Object
com.atlassian.confluence.macro.query.SimpleSearchQueryParser
Parses
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.
- Since:
- 2.9
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleSearchQueryParser
(SearchQueryInterpreter interpreter) Constructs a new parser using the specifiedSearchQueryInterpreter
to transform string tokens intoSearchQuery
implementations.SimpleSearchQueryParser
(SearchQueryInterpreter interpreter, InclusionCriteria defaultInclusionCriteria) Constructs a new parser using the specifiedSearchQueryInterpreter
to transform string tokens intoSearchQuery
implementations and using the specifiedInclusionCriteria
as the default criteria for untagged tokens. -
Method Summary
Modifier and TypeMethodDescriptionParses the specifiedString
into aBooleanQueryFactory
implementation according to the rules specified by theSearchQueryInterpreter
.void
setDefaultInclusionCriteria
(InclusionCriteria criteria) Sets whichInclusionCriteria
should be applied to a value in the absence of a specific token.
-
Constructor Details
-
SimpleSearchQueryParser
Constructs a new parser using the specifiedSearchQueryInterpreter
to transform string tokens intoSearchQuery
implementations. The defaultInclusionCriteria
is ANY.- Parameters:
interpreter
- theSearchQueryInterpreter
implementation to use
-
SimpleSearchQueryParser
public SimpleSearchQueryParser(SearchQueryInterpreter interpreter, InclusionCriteria defaultInclusionCriteria) Constructs a new parser using the specifiedSearchQueryInterpreter
to transform string tokens intoSearchQuery
implementations and using the specifiedInclusionCriteria
as the default criteria for untagged tokens.- Parameters:
interpreter
- theSearchQueryInterpreter
implementation to usedefaultInclusionCriteria
- the defaultInclusionCriteria
for untagged tokens
-
-
Method Details
-
setDefaultInclusionCriteria
Sets whichInclusionCriteria
should be applied to a value in the absence of a specific token.- Parameters:
criteria
- the defaultInclusionCriteria
value to use
-
parse
Parses the specifiedString
into aBooleanQueryFactory
implementation according to the rules specified by theSearchQueryInterpreter
.- Parameters:
query
- theString
to parse- Returns:
- a
BooleanQueryFactory
corresponding to the String - Throws:
SearchQueryParserException
- if an error occurs during parsing
-