Class SimpleSearchQueryParser

java.lang.Object
com.atlassian.confluence.macro.query.SimpleSearchQueryParser

public final class SimpleSearchQueryParser extends Object
Parses Strings 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 Details

    • SimpleSearchQueryParser

      public SimpleSearchQueryParser(SearchQueryInterpreter interpreter)
      Constructs a new parser using the specified SearchQueryInterpreter to transform string tokens into SearchQuery implementations. The default InclusionCriteria is ANY.
      Parameters:
      interpreter - the SearchQueryInterpreter implementation to use
    • SimpleSearchQueryParser

      public 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.
      Parameters:
      interpreter - the SearchQueryInterpreter implementation to use
      defaultInclusionCriteria - the default InclusionCriteria for untagged tokens
  • Method Details

    • setDefaultInclusionCriteria

      public void setDefaultInclusionCriteria(InclusionCriteria criteria)
      Sets which InclusionCriteria should be applied to a value in the absence of a specific token.
      Parameters:
      criteria - the default InclusionCriteria value to use
    • parse

      Parses the specified String into a BooleanQueryFactory implementation according to the rules specified by the SearchQueryInterpreter.
      Parameters:
      query - the String to parse
      Returns:
      a BooleanQueryFactory corresponding to the String
      Throws:
      SearchQueryParserException - if an error occurs during parsing