Overview | Package | Class | Tree | Deprecated | Index | Help
| Qizx/Open v0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.xfra.qizxopen.dm
Class FulltextQuery

    java.lang.Object
      |
      +--net.xfra.qizxopen.dm.FulltextQuery

public class FulltextQuery
extends java.lang.Object

Implementation of full-text queries:

- parsing,
- search in fall-back mode (without indexes),
- term highlighting.

A query is a AND of required and excluded clauses. A clause is a phrase or an alternative of terms. A term is a simple word, a word with wildcards (a la Unix) or an approximate word (uses a generic Soundex-like phonetic algorithm).

Syntax:

      	query -> clause [ ['AND' | '&']?  ['NOT' | '-']?  clause]*
      	clause -> ORterm | phrase
      	phrase -> '"' term+ '"' distance?  |  '\'' term+ '\'' distance?
      	ORterm -> term [ ['OR' | '|'] term]*
     	term -> [ wordchar | '*' | '?' ]+ distance?
      	distance -> '~' integer?

Nested Class Summary
`static class` | `FulltextQuery.Clause` Abstract clause.
`class` | `FulltextQuery.Hiliter` Defines the way highlighted words are decorated: a highlighted word is surrounded by an element of the form word, where N is the rank of the fulltext clause (phrase or alternative of terms), E is the 'element' field of this hiliter (a QName with default value "span"), A is the 'attribute' field (a QName with default value "class"), and pattern is a string prefix to the attribute value (by default empty).
`static class` | `FulltextQuery.ParseException`
`static class` | `FulltextQuery.Phrase` Sequence of terms, with an optional total spacing between terms.
`static class` | `FulltextQuery.Term` A simple word or a pattern.
`static class` | `FulltextQuery.TermOr` Union of terms.

Field Summary
`FulltextQuery.Clause[]` | `excluded`
`FulltextQuery.Clause[]` | `required`
`WordExtractor` | `wordExtractor`

Constructor Summary
`FulltextQuery()`

Method Summary
`void` | `highlight(Node fragment, FulltextQuery.Hiliter hiliter, XMLEventReceiver result)` Highlighting matching nodes inside a document fragment with hiliter patterns.
`boolean` | `matches(Node node)` Tells whether the text contents of the node matches this query.
`static FulltextQuery` | `parsePhrase(java.lang.String query, int distance, WordExtractor extractor)` Parses and builds a phrase query: simple sequence of terms without quotes.
`static FulltextQuery` | `parseQuery(java.lang.String query, WordExtractor extractor)` Parses and builds a general FulltextQuery.
`java.lang.String` | `toString()`

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

Field Detail

### required

    public FulltextQuery.Clause[] required

### excluded

    public FulltextQuery.Clause[] excluded

### wordExtractor

    public WordExtractor wordExtractor

Constructor Detail

### FulltextQuery

    public FulltextQuery()

Method Detail

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### parseQuery

    public static FulltextQuery parseQuery(java.lang.String query,
                                           WordExtractor extractor)
                                    throws FulltextQuery.ParseException

  Parses and builds a general FulltextQuery.

  Parameters:
    `query` - parsed query expression.
    `extractor` - used for extracting and normalizing terms.
    `FulltextQuery.ParseException`

### parsePhrase

    public static FulltextQuery parsePhrase(java.lang.String query,
                                            int distance,
                                            WordExtractor extractor)
                                     throws FulltextQuery.ParseException

  Parses and builds a phrase query: simple sequence of terms without quotes.

  Parameters:
    `query` - parsed query expression.
    `distance` - maximum number of interspersed words (0 for exact phrase).
    `extractor` - used for extracting and normalizing terms.
    `FulltextQuery.ParseException`

### matches

    public boolean matches(Node node)

  Tells whether the text contents of the node matches this query.

### highlight

    public void highlight(Node fragment,
                          FulltextQuery.Hiliter hiliter,
                          XMLEventReceiver result)
                   throws DataModelException

  Highlighting matching nodes inside a document fragment with hiliter patterns.

  Parameters:
    `fragment` - source document fragment
    `hiliter` - defines the way highlighted words are decorated (see `FulltextQuery.Hiliter`).
    `result` - hilighted output.
    `DataModelException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright Xavier FRANC 2003-2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD