org.jboss.dna.graph.query.parse
Class FullTextSearchParser

java.lang.Object
  extended by org.jboss.dna.graph.query.parse.FullTextSearchParser

public class FullTextSearchParser
extends Object

A QueryParser implementation that parses a full-text search expression. This grammar is based on the full-text search grammar as defined by the JCR 2.0 specification.

Grammar

The grammar for the full-text expression is taken from the JCR 2.0 specification, and is as follows:

 FulltextSearch ::= Disjunct {Space 'OR' Space Disjunct}
 Disjunct ::= Term {Space Term}
 Term ::= ['-'] SimpleTerm
 SimpleTerm ::= Word | '"' Word {Space Word} '"'
 Word ::= NonSpaceChar {NonSpaceChar}
 Space ::= SpaceChar {SpaceChar}
 NonSpaceChar ::= Char - SpaceChar /* Any Char except SpaceChar */
 SpaceChar ::= ' '
 Char ::= /* Any character */
 


Constructor Summary
FullTextSearchParser()
           
 
Method Summary
 FullTextSearch.Term parse(String fullTextSearchExpression)
          Parse the full-text search criteria given in the supplied string.
 FullTextSearch.Term parse(TokenStream tokens)
          Parse the full-text search criteria from the supplied token stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FullTextSearchParser

public FullTextSearchParser()
Method Detail

parse

public FullTextSearch.Term parse(String fullTextSearchExpression)
Parse the full-text search criteria given in the supplied string.

Parameters:
fullTextSearchExpression - the full-text search expression; may not be null
Returns:
the term representation of the full-text search, or null if there are no terms
Throws:
ParsingException - if there is an error parsing the supplied string
IllegalArgumentException - if the expression is null

parse

public FullTextSearch.Term parse(TokenStream tokens)
Parse the full-text search criteria from the supplied token stream. This method is useful when the full-text search expression is included in other content.

Parameters:
tokens - the token stream containing the full-text search starting on the next token
Returns:
the term representation of the full-text search, or null if there are no terms
Throws:
ParsingException - if there is an error parsing the supplied string
IllegalArgumentException - if the token stream is null


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.