Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Qizx/open 4.1 API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.qizx.api.fulltext
Interface FullTextPullStream

All Superinterfaces:
  XMLPullStream

All Known Implementing Classes:
  FullTextHighlighter, FullTextSnippetExtractor

    public interface FullTextPullStream

extends XMLPullStream

An extension of XMLPullStream that separates fragments of text matching the key terms of a full-text query. This is typically used for "highlighting" full-text terms, by wrapping full-text terms with some decoration, for example a B or SPAN element in HTML.

Note that this interface does not define how the full-text query is specified.

A Text node that contains one or several terms of a full-text query generates several events of type TEXT and FT_TERM, instead of simply one.

Example: the full-text query is: `. ftcontains 'romeo juliet'`, and the BasicFullTextPullStream is used on this document:

    <PLAY>
      <TITLE>The Tragedy of Romeo and Juliet</TITLE>
      <FM> ...

Events generated are successively:

DOCUMENT_START |  |
ELEMENT_START | name=PLAY |
ELEMENT_START | name=TITLE |
TEXT | text='The Tragedy of ' | wordCount=3
FT_TERM | text='Romeo' | wordCount=1 , termPosition=0
TEXT | text=' and ' | wordCount=1
FT_TERM | text='Juliet' | wordCount=1 , termPosition=1
ELEMENT_END | name=TITLE |
... | ... |

Additional information is returned on each fragment TEXT or FT_TERM:

- Query-position of the term, an integer value that represents the rank of the term in the query [noted termPosition above].

- Number of words in the fragment (always 1 for FT_TERM, since phrases are not recognized as a single piece).

Field Summary
`static int` | `FT_TERM` Event code returned when a query word or phrase is recognized.

Fields inherited from interface com.qizx.api.XMLPullStream
`COMMENT, DOCUMENT_END, DOCUMENT_START, ELEMENT_END, ELEMENT_START, END, PROCESSING_INSTRUCTION, START, TEXT`

Method Summary
`int` | `getQueryTermCount()` Returns the number of terms in the query.
`String[]` | `getQueryTerms()` Returns the terms of the query as a String array.
`int` | `getTermPosition()` On a FT_TERM event, returns the rank of the term (word, wildcard) in the full-text query.
`int` | `getWordCount()` On a TEXT or FT_TERM event, returns the number of words in the text chunk.

Methods inherited from interface com.qizx.api.XMLPullStream
`getAttributeCount, getAttributeName, getAttributeValue, getCurrentEvent, getCurrentNode, getDTDName, getDTDPublicId, getDTDSystemId, getEncoding, getInternalSubset, getName, getNamespaceCount, getNamespacePrefix, getNamespaceURI, getTarget, getText, getTextLength, moveToNextEvent`

Field Detail

### FT_TERM

    static final int FT_TERM

  Event code returned when a query word or phrase is recognized.

  See Also:
    Constant Field Values

Method Detail

### getTermPosition

    int getTermPosition()

  On a FT_TERM event, returns the rank of the term (word, wildcard) in the full-text query. Depends on the actual implementation of this interface.

  Example: in the following query, terms 'romeo' has position 0, and term 'juliet' has position 1.

       . ftcontains "romeo juliet" all words

  Note that excluded terms (following `ftnot` or `not in`) are ignored.

### getWordCount

    int getWordCount()

  On a TEXT or FT_TERM event, returns the number of words in the text chunk. For a FT_TERM, the value returned is 1, because phrases are not recognized as a whole.

### getQueryTermCount

    int getQueryTermCount()

  Returns the number of terms in the query.

### getQueryTerms

    String[] getQueryTerms()

  Returns the terms of the query as a String array.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| © 2010 Axyana Software
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD