Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.query.parse
Class FullTextSearchParser

    java.lang.Object
      org.modeshape.jcr.query.parse.FullTextSearchParser

All Implemented Interfaces:
  QueryParser

    public class FullTextSearchParser

extends Object
implements QueryParser

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 */

Nested Class Summary
`static class` | `FullTextSearchParser.TermTokenizer` A basic `TokenStream.Tokenizer` implementation that ignores whitespace but includes tokens for individual symbols, the period ('.'), single-quoted strings, double-quoted strings, whitespace-delimited words, and optionally comments.

Field Summary
`protected static List<? extends Column>` | `FULL_TEXT_COLUMNS`
`static String` | `LANGUAGE`

Constructor Summary
`FullTextSearchParser()`

Method Summary
`String` | `getLanguage()` Get the name of the language that this parser is able to understand.
`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.
`protected FullTextSearch.Term` | `parseDisjunctedTerms(TokenStream tokens)`
`QueryCommand` | `parseQuery(String query, TypeSystem typeSystem)` Parse the supplied query from a string representation into a `QueryCommand`.
`protected FullTextSearch.Term` | `parseTerm(TokenStream tokens)`
`protected String` | `removeQuotes(String text)` Remove any leading and trailing single- or double-quotes from the supplied text.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LANGUAGE

    public static final String LANGUAGE

See Also:
  Constant Field Values

### FULL_TEXT_COLUMNS

    protected static List<? extends Column> FULL_TEXT_COLUMNS

Constructor Detail

### FullTextSearchParser

    public FullTextSearchParser()

Method Detail

### getLanguage

    public String getLanguage()

  Description copied from interface: `QueryParser`
  Get the name of the language that this parser is able to understand.

  Specified by:
    `getLanguage` in interface `QueryParser`
  Returns:
    the language name; never null

### parseQuery

    public QueryCommand parseQuery(String query,
                                   TypeSystem typeSystem)
                            throws InvalidQueryException

  Description copied from interface: `QueryParser`
  Parse the supplied query from a string representation into a `QueryCommand`.

  Specified by:
    `parseQuery` in interface `QueryParser`
  Parameters:
    `query` - the query in string form; may not be null
    `typeSystem` - the type system used by the query; may not be null
  Returns:
    the query command
  Throws:
    `InvalidQueryException` - if the supplied query can be parsed but is invalid

### 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

### parseDisjunctedTerms

    protected FullTextSearch.Term parseDisjunctedTerms(TokenStream tokens)

### parseTerm

    protected FullTextSearch.Term parseTerm(TokenStream tokens)

### removeQuotes

    protected String removeQuotes(String text)

  Remove any leading and trailing single- or double-quotes from the supplied text.

  Parameters:
    `text` - the input text; may not be null
  Returns:
    the text without leading and trailing quotes, or `text` if there were no quotes

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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