public final class

SimpleSearchQueryParser

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

Class Overview

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.

Summary

Public Constructors
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.
Public Methods
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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

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

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

Public Methods

public BooleanQueryFactory parse (String query)

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

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