|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.search.highlight.TokenSources
public class TokenSources
Hides implementation issues associated with obtaining a TokenStream for use with the higlighter - can obtain from TermFreqVectors with offsets and (optionally) positions or from Analyzer class reparsing the stored content.
Constructor Summary | |
---|---|
TokenSources()
|
Method Summary | |
---|---|
static TokenStream |
getAnyTokenStream(IndexReader reader,
int docId,
String field,
Analyzer analyzer)
A convenience method that tries a number of approaches to getting a token stream. |
static TokenStream |
getAnyTokenStream(IndexReader reader,
int docId,
String field,
Document doc,
Analyzer analyzer)
A convenience method that tries to first get a TermPositionVector for the specified docId, then, falls back to using the passed in Document to retrieve the TokenStream. |
static TokenStream |
getTokenStream(Document doc,
String field,
Analyzer analyzer)
|
static TokenStream |
getTokenStream(IndexReader reader,
int docId,
String field)
|
static TokenStream |
getTokenStream(IndexReader reader,
int docId,
String field,
Analyzer analyzer)
|
static TokenStream |
getTokenStream(String field,
String contents,
Analyzer analyzer)
|
static TokenStream |
getTokenStream(TermPositionVector tpv)
|
static TokenStream |
getTokenStream(TermPositionVector tpv,
boolean tokenPositionsGuaranteedContiguous)
Low level api. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TokenSources()
Method Detail |
---|
public static TokenStream getAnyTokenStream(IndexReader reader, int docId, String field, Document doc, Analyzer analyzer) throws IOException
Document
to retrieve the TokenStream.
This is useful when you already have the document, but would prefer to use
the vector first.
reader
- The IndexReader
to use to try
and get the vector fromdocId
- The docId to retrieve.field
- The field to retrieve on the documentdoc
- The document to fall back onanalyzer
- The analyzer to use for creating the TokenStream if the
vector doesn't exist
TokenStream
for the
Fieldable
on the
Document
IOException
- if there was an error loadingpublic static TokenStream getAnyTokenStream(IndexReader reader, int docId, String field, Analyzer analyzer) throws IOException
reader
- docId
- field
- analyzer
-
IOException
public static TokenStream getTokenStream(TermPositionVector tpv)
public static TokenStream getTokenStream(TermPositionVector tpv, boolean tokenPositionsGuaranteedContiguous)
tpv
- tokenPositionsGuaranteedContiguous
- true if the token position
numbers have no overlaps or gaps. If looking to eek out the last
drops of performance, set to true. If in doubt, set to false.public static TokenStream getTokenStream(IndexReader reader, int docId, String field) throws IOException
IOException
public static TokenStream getTokenStream(IndexReader reader, int docId, String field, Analyzer analyzer) throws IOException
IOException
public static TokenStream getTokenStream(Document doc, String field, Analyzer analyzer)
public static TokenStream getTokenStream(String field, String contents, Analyzer analyzer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |