Class BaseFragmentsBuilder
- java.lang.Object
-
- org.apache.lucene.search.vectorhighlight.BaseFragmentsBuilder
-
- All Implemented Interfaces:
FragmentsBuilder
- Direct Known Subclasses:
ScoreOrderFragmentsBuilder
,SimpleFragmentsBuilder
public abstract class BaseFragmentsBuilder extends java.lang.Object implements FragmentsBuilder
Base FragmentsBuilder implementation that supports colored pre/post tags and multivalued fields.Uses
BoundaryScanner
to determine fragments.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]
COLORED_POST_TAGS
static java.lang.String[]
COLORED_PRE_TAGS
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String
createFragment(IndexReader reader, int docId, java.lang.String fieldName, FieldFragList fieldFragList)
create a fragment.java.lang.String
createFragment(IndexReader reader, int docId, java.lang.String fieldName, FieldFragList fieldFragList, java.lang.String[] preTags, java.lang.String[] postTags, Encoder encoder)
create a fragment.java.lang.String[]
createFragments(IndexReader reader, int docId, java.lang.String fieldName, FieldFragList fieldFragList, int maxNumFragments)
create multiple fragments.java.lang.String[]
createFragments(IndexReader reader, int docId, java.lang.String fieldName, FieldFragList fieldFragList, int maxNumFragments, java.lang.String[] preTags, java.lang.String[] postTags, Encoder encoder)
create multiple fragments.char
getMultiValuedSeparator()
abstract java.util.List<FieldFragList.WeightedFragInfo>
getWeightedFragInfoList(java.util.List<FieldFragList.WeightedFragInfo> src)
boolean
isDiscreteMultiValueHighlighting()
void
setDiscreteMultiValueHighlighting(boolean discreteMultiValueHighlighting)
void
setMultiValuedSeparator(char separator)
-
-
-
Method Detail
-
getWeightedFragInfoList
public abstract java.util.List<FieldFragList.WeightedFragInfo> getWeightedFragInfoList(java.util.List<FieldFragList.WeightedFragInfo> src)
-
createFragment
public java.lang.String createFragment(IndexReader reader, int docId, java.lang.String fieldName, FieldFragList fieldFragList) throws java.io.IOException
Description copied from interface:FragmentsBuilder
create a fragment.- Specified by:
createFragment
in interfaceFragmentsBuilder
- Parameters:
reader
- IndexReader of the indexdocId
- document id to be highlightedfieldName
- field of the document to be highlightedfieldFragList
- FieldFragList object- Returns:
- a created fragment or null when no fragment created
- Throws:
java.io.IOException
- If there is a low-level I/O error
-
createFragments
public java.lang.String[] createFragments(IndexReader reader, int docId, java.lang.String fieldName, FieldFragList fieldFragList, int maxNumFragments) throws java.io.IOException
Description copied from interface:FragmentsBuilder
create multiple fragments.- Specified by:
createFragments
in interfaceFragmentsBuilder
- Parameters:
reader
- IndexReader of the indexdocId
- document id to be highlighterfieldName
- field of the document to be highlightedfieldFragList
- FieldFragList objectmaxNumFragments
- maximum number of fragments- Returns:
- created fragments or null when no fragments created. size of the array can be less than maxNumFragments
- Throws:
java.io.IOException
- If there is a low-level I/O error
-
createFragment
public java.lang.String createFragment(IndexReader reader, int docId, java.lang.String fieldName, FieldFragList fieldFragList, java.lang.String[] preTags, java.lang.String[] postTags, Encoder encoder) throws java.io.IOException
Description copied from interface:FragmentsBuilder
create a fragment.- Specified by:
createFragment
in interfaceFragmentsBuilder
- Parameters:
reader
- IndexReader of the indexdocId
- document id to be highlightedfieldName
- field of the document to be highlightedfieldFragList
- FieldFragList objectpreTags
- pre-tags to be used to highlight termspostTags
- post-tags to be used to highlight termsencoder
- an encoder that generates encoded text- Returns:
- a created fragment or null when no fragment created
- Throws:
java.io.IOException
- If there is a low-level I/O error
-
createFragments
public java.lang.String[] createFragments(IndexReader reader, int docId, java.lang.String fieldName, FieldFragList fieldFragList, int maxNumFragments, java.lang.String[] preTags, java.lang.String[] postTags, Encoder encoder) throws java.io.IOException
Description copied from interface:FragmentsBuilder
create multiple fragments.- Specified by:
createFragments
in interfaceFragmentsBuilder
- Parameters:
reader
- IndexReader of the indexdocId
- document id to be highlighterfieldName
- field of the document to be highlightedfieldFragList
- FieldFragList objectmaxNumFragments
- maximum number of fragmentspreTags
- pre-tags to be used to highlight termspostTags
- post-tags to be used to highlight termsencoder
- an encoder that generates encoded text- Returns:
- created fragments or null when no fragments created. size of the array can be less than maxNumFragments
- Throws:
java.io.IOException
- If there is a low-level I/O error
-
setMultiValuedSeparator
public void setMultiValuedSeparator(char separator)
-
getMultiValuedSeparator
public char getMultiValuedSeparator()
-
isDiscreteMultiValueHighlighting
public boolean isDiscreteMultiValueHighlighting()
-
setDiscreteMultiValueHighlighting
public void setDiscreteMultiValueHighlighting(boolean discreteMultiValueHighlighting)
-
-