public class FastVectorHighlighter extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_FIELD_MATCH |
static boolean |
DEFAULT_PHRASE_HIGHLIGHT |
protected boolean |
fieldMatch |
protected boolean |
phraseHighlight |
Constructor and Description |
---|
FastVectorHighlighter()
the default constructor.
|
FastVectorHighlighter(boolean phraseHighlight,
boolean fieldMatch)
a constructor.
|
FastVectorHighlighter(boolean phraseHighlight,
boolean fieldMatch,
FragListBuilder fragListBuilder,
FragmentsBuilder fragmentsBuilder)
a constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
getBestFragment(FieldQuery fieldQuery,
IndexReader reader,
int docId,
String fieldName,
int fragCharSize)
return the best fragment.
|
String |
getBestFragment(FieldQuery fieldQuery,
IndexReader reader,
int docId,
String fieldName,
int fragCharSize,
FragListBuilder fragListBuilder,
FragmentsBuilder fragmentsBuilder,
String[] preTags,
String[] postTags,
Encoder encoder)
return the best fragment.
|
String[] |
getBestFragments(FieldQuery fieldQuery,
IndexReader reader,
int docId,
String fieldName,
int fragCharSize,
int maxNumFragments)
return the best fragments.
|
String[] |
getBestFragments(FieldQuery fieldQuery,
IndexReader reader,
int docId,
String fieldName,
int fragCharSize,
int maxNumFragments,
FragListBuilder fragListBuilder,
FragmentsBuilder fragmentsBuilder,
String[] preTags,
String[] postTags,
Encoder encoder)
return the best fragments.
|
String[] |
getBestFragments(FieldQuery fieldQuery,
IndexReader reader,
int docId,
String storedField,
Set<String> matchedFields,
int fragCharSize,
int maxNumFragments,
FragListBuilder fragListBuilder,
FragmentsBuilder fragmentsBuilder,
String[] preTags,
String[] postTags,
Encoder encoder)
Return the best fragments.
|
FieldQuery |
getFieldQuery(Query query)
create a
FieldQuery object. |
FieldQuery |
getFieldQuery(Query query,
IndexReader reader)
create a
FieldQuery object. |
int |
getPhraseLimit() |
boolean |
isFieldMatch()
return whether fieldMatch or not.
|
boolean |
isPhraseHighlight()
return whether phraseHighlight or not.
|
void |
setPhraseLimit(int phraseLimit)
set the maximum number of phrases to analyze when searching for the highest-scoring phrase.
|
public static final boolean DEFAULT_PHRASE_HIGHLIGHT
public static final boolean DEFAULT_FIELD_MATCH
protected final boolean phraseHighlight
protected final boolean fieldMatch
public FastVectorHighlighter()
public FastVectorHighlighter(boolean phraseHighlight, boolean fieldMatch)
SimpleFragListBuilder
and ScoreOrderFragmentsBuilder
.phraseHighlight
- true or false for phrase highlightingfieldMatch
- true of false for field matchingpublic FastVectorHighlighter(boolean phraseHighlight, boolean fieldMatch, FragListBuilder fragListBuilder, FragmentsBuilder fragmentsBuilder)
FragListBuilder
and a FragmentsBuilder
can be specified (plugins).phraseHighlight
- true of false for phrase highlightingfieldMatch
- true of false for field matchingfragListBuilder
- an instance of FragListBuilder
fragmentsBuilder
- an instance of FragmentsBuilder
public FieldQuery getFieldQuery(Query query)
FieldQuery
object.query
- a queryFieldQuery
objectpublic FieldQuery getFieldQuery(Query query, IndexReader reader) throws IOException
FieldQuery
object.query
- a queryFieldQuery
objectIOException
public final String getBestFragment(FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize) throws IOException
fieldQuery
- FieldQuery
objectreader
- IndexReader
of the indexdocId
- document id to be highlightedfieldName
- field of the document to be highlightedfragCharSize
- the length (number of chars) of a fragmentIOException
- If there is a low-level I/O errorpublic final String[] getBestFragments(FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize, int maxNumFragments) throws IOException
fieldQuery
- FieldQuery
objectreader
- IndexReader
of the indexdocId
- document id to be highlightedfieldName
- field of the document to be highlightedfragCharSize
- the length (number of chars) of a fragmentmaxNumFragments
- maximum number of fragmentsIOException
- If there is a low-level I/O errorpublic final String getBestFragment(FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize, FragListBuilder fragListBuilder, FragmentsBuilder fragmentsBuilder, String[] preTags, String[] postTags, Encoder encoder) throws IOException
fieldQuery
- FieldQuery
objectreader
- IndexReader
of the indexdocId
- document id to be highlightedfieldName
- field of the document to be highlightedfragCharSize
- the length (number of chars) of a fragmentfragListBuilder
- FragListBuilder
objectfragmentsBuilder
- FragmentsBuilder
objectpreTags
- pre-tags to be used to highlight termspostTags
- post-tags to be used to highlight termsencoder
- an encoder that generates encoded textIOException
- If there is a low-level I/O errorpublic final String[] getBestFragments(FieldQuery fieldQuery, IndexReader reader, int docId, String fieldName, int fragCharSize, int maxNumFragments, FragListBuilder fragListBuilder, FragmentsBuilder fragmentsBuilder, String[] preTags, String[] postTags, Encoder encoder) throws IOException
fieldQuery
- FieldQuery
objectreader
- IndexReader
of the indexdocId
- document id to be highlightedfieldName
- field of the document to be highlightedfragCharSize
- the length (number of chars) of a fragmentmaxNumFragments
- maximum number of fragmentsfragListBuilder
- FragListBuilder
objectfragmentsBuilder
- FragmentsBuilder
objectpreTags
- pre-tags to be used to highlight termspostTags
- post-tags to be used to highlight termsencoder
- an encoder that generates encoded textIOException
- If there is a low-level I/O errorpublic final String[] getBestFragments(FieldQuery fieldQuery, IndexReader reader, int docId, String storedField, Set<String> matchedFields, int fragCharSize, int maxNumFragments, FragListBuilder fragListBuilder, FragmentsBuilder fragmentsBuilder, String[] preTags, String[] postTags, Encoder encoder) throws IOException
StringIndexOutOfBoundsException
if matchedFields produces offsets outside of storedField. As such it is advisable that all
matchedFields share the same source as storedField or are at least a prefix of it.fieldQuery
- FieldQuery
objectreader
- IndexReader
of the indexdocId
- document id to be highlightedstoredField
- field of the document that stores the textmatchedFields
- fields of the document to scan for matchesfragCharSize
- the length (number of chars) of a fragmentmaxNumFragments
- maximum number of fragmentsfragListBuilder
- FragListBuilder
objectfragmentsBuilder
- FragmentsBuilder
objectpreTags
- pre-tags to be used to highlight termspostTags
- post-tags to be used to highlight termsencoder
- an encoder that generates encoded textIOException
- If there is a low-level I/O errorpublic boolean isPhraseHighlight()
public boolean isFieldMatch()
public int getPhraseLimit()
public void setPhraseLimit(int phraseLimit)
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.