com.atlassian.confluence.macro.query
Class SimpleSearchQueryParser

java.lang.Object
  extended by 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 Summary
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.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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

public BooleanQueryFactory parse(String query)
                          throws SearchQueryParserException
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


Copyright © 2003-2012 Atlassian. All Rights Reserved.