Class SimpleSearchQueryParser
- java.lang.Object
-
- com.atlassian.confluence.macro.query.SimpleSearchQueryParser
-
public final class SimpleSearchQueryParser extends Object
ParsesStrings intoSearchQueryimplementations according to theSearchQueryInterpreterprovided at construction time and returns aBooleanQueryFactory.Strings are split into tokens separated by commas or whitespace. They are inserted into a
BooleanQueryFactorybased on the token preceding them, which areInclusionCriteriaimplementations.- Since:
- 2.9
-
-
Constructor Summary
Constructors Constructor Description SimpleSearchQueryParser(SearchQueryInterpreter interpreter)Constructs a new parser using the specifiedSearchQueryInterpreterto transform string tokens intoSearchQueryimplementations.SimpleSearchQueryParser(SearchQueryInterpreter interpreter, InclusionCriteria defaultInclusionCriteria)Constructs a new parser using the specifiedSearchQueryInterpreterto transform string tokens intoSearchQueryimplementations and using the specifiedInclusionCriteriaas the default criteria for untagged tokens.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleanQueryFactoryparse(String query)Parses the specifiedStringinto aBooleanQueryFactoryimplementation according to the rules specified by theSearchQueryInterpreter.voidsetDefaultInclusionCriteria(InclusionCriteria criteria)Sets whichInclusionCriteriashould 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 specifiedSearchQueryInterpreterto transform string tokens intoSearchQueryimplementations. The defaultInclusionCriteriais ANY.- Parameters:
interpreter- theSearchQueryInterpreterimplementation to use
-
SimpleSearchQueryParser
public SimpleSearchQueryParser(SearchQueryInterpreter interpreter, InclusionCriteria defaultInclusionCriteria)
Constructs a new parser using the specifiedSearchQueryInterpreterto transform string tokens intoSearchQueryimplementations and using the specifiedInclusionCriteriaas the default criteria for untagged tokens.- Parameters:
interpreter- theSearchQueryInterpreterimplementation to usedefaultInclusionCriteria- the defaultInclusionCriteriafor untagged tokens
-
-
Method Detail
-
setDefaultInclusionCriteria
public void setDefaultInclusionCriteria(InclusionCriteria criteria)
Sets whichInclusionCriteriashould be applied to a value in the absence of a specific token.- Parameters:
criteria- the defaultInclusionCriteriavalue to use
-
parse
public BooleanQueryFactory parse(String query) throws SearchQueryParserException
Parses the specifiedStringinto aBooleanQueryFactoryimplementation according to the rules specified by theSearchQueryInterpreter.- Parameters:
query- theStringto parse- Returns:
- a
BooleanQueryFactorycorresponding to the String - Throws:
SearchQueryParserException- if an error occurs during parsing
-
-