public class TokenSources extends Object
Constructor and Description |
---|
TokenSources() |
Modifier and Type | Method and Description |
---|---|
static org.apache.lucene.analysis.TokenStream |
getAnyTokenStream(org.apache.lucene.index.IndexReader reader,
int docId,
String field,
org.apache.lucene.analysis.Analyzer analyzer)
A convenience method that tries a number of approaches to getting a token
stream.
|
static org.apache.lucene.analysis.TokenStream |
getAnyTokenStream(org.apache.lucene.index.IndexReader reader,
int docId,
String field,
org.apache.lucene.document.Document doc,
org.apache.lucene.analysis.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 org.apache.lucene.analysis.TokenStream |
getTokenStream(org.apache.lucene.document.Document doc,
String field,
org.apache.lucene.analysis.Analyzer analyzer) |
static org.apache.lucene.analysis.TokenStream |
getTokenStream(org.apache.lucene.index.IndexReader reader,
int docId,
String field) |
static org.apache.lucene.analysis.TokenStream |
getTokenStream(org.apache.lucene.index.IndexReader reader,
int docId,
String field,
org.apache.lucene.analysis.Analyzer analyzer) |
static org.apache.lucene.analysis.TokenStream |
getTokenStream(String field,
String contents,
org.apache.lucene.analysis.Analyzer analyzer) |
static org.apache.lucene.analysis.TokenStream |
getTokenStream(org.apache.lucene.index.TermPositionVector tpv) |
static org.apache.lucene.analysis.TokenStream |
getTokenStream(org.apache.lucene.index.TermPositionVector tpv,
boolean tokenPositionsGuaranteedContiguous)
Low level api.
|
public static org.apache.lucene.analysis.TokenStream getAnyTokenStream(org.apache.lucene.index.IndexReader reader, int docId, String field, org.apache.lucene.document.Document doc, org.apache.lucene.analysis.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 existTokenStream
for the
Fieldable
on the
Document
IOException
- if there was an error loadingpublic static org.apache.lucene.analysis.TokenStream getAnyTokenStream(org.apache.lucene.index.IndexReader reader, int docId, String field, org.apache.lucene.analysis.Analyzer analyzer) throws IOException
reader
- docId
- field
- analyzer
- IOException
public static org.apache.lucene.analysis.TokenStream getTokenStream(org.apache.lucene.index.TermPositionVector tpv)
public static org.apache.lucene.analysis.TokenStream getTokenStream(org.apache.lucene.index.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 org.apache.lucene.analysis.TokenStream getTokenStream(org.apache.lucene.index.IndexReader reader, int docId, String field) throws IOException
IOException
public static org.apache.lucene.analysis.TokenStream getTokenStream(org.apache.lucene.index.IndexReader reader, int docId, String field, org.apache.lucene.analysis.Analyzer analyzer) throws IOException
IOException
public static org.apache.lucene.analysis.TokenStream getTokenStream(org.apache.lucene.document.Document doc, String field, org.apache.lucene.analysis.Analyzer analyzer)