Class SimpleSearchQueryParser
- java.lang.Object
-
- com.atlassian.confluence.macro.query.SimpleSearchQueryParser
-
public final class SimpleSearchQueryParser extends Object
ParsesString
s intoSearchQuery
implementations according to theSearchQueryInterpreter
provided at construction time and returns aBooleanQueryFactory
.Strings are split into tokens separated by commas or whitespace. They are inserted into a
BooleanQueryFactory
based on the token preceding them, which areInclusionCriteria
implementations.- Since:
- 2.9
-
-
Constructor Summary
Constructors Constructor Description SimpleSearchQueryParser(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleanQueryFactory
parse(String query)
Parses 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 Detail
-
SimpleSearchQueryParser
public SimpleSearchQueryParser(SearchQueryInterpreter interpreter)
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 Detail
-
setDefaultInclusionCriteria
public void setDefaultInclusionCriteria(InclusionCriteria criteria)
Sets whichInclusionCriteria
should be applied to a value in the absence of a specific token.- Parameters:
criteria
- the defaultInclusionCriteria
value to use
-
parse
public BooleanQueryFactory parse(String query) throws SearchQueryParserException
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
-
-