public abstract class BaseFragmentsBuilder extends Object implements FragmentsBuilder
Uses BoundaryScanner
to determine fragments.
Modifier and Type | Field and Description |
---|---|
static String[] |
COLORED_POST_TAGS |
static String[] |
COLORED_PRE_TAGS |
protected String[] |
postTags |
protected String[] |
preTags |
Modifier | Constructor and Description |
---|---|
protected |
BaseFragmentsBuilder() |
protected |
BaseFragmentsBuilder(BoundaryScanner boundaryScanner) |
protected |
BaseFragmentsBuilder(String[] preTags,
String[] postTags) |
protected |
BaseFragmentsBuilder(String[] preTags,
String[] postTags,
BoundaryScanner boundaryScanner) |
Modifier and Type | Method and Description |
---|---|
String |
createFragment(IndexReader reader,
int docId,
String fieldName,
FieldFragList fieldFragList)
create a fragment.
|
String |
createFragment(IndexReader reader,
int docId,
String fieldName,
FieldFragList fieldFragList,
String[] preTags,
String[] postTags,
Encoder encoder)
create a fragment.
|
String[] |
createFragments(IndexReader reader,
int docId,
String fieldName,
FieldFragList fieldFragList,
int maxNumFragments)
create multiple fragments.
|
String[] |
createFragments(IndexReader reader,
int docId,
String fieldName,
FieldFragList fieldFragList,
int maxNumFragments,
String[] preTags,
String[] postTags,
Encoder encoder)
create multiple fragments.
|
protected List<FieldFragList.WeightedFragInfo> |
discreteMultiValueHighlighting(List<FieldFragList.WeightedFragInfo> fragInfos,
Field[] fields) |
protected Field[] |
getFields(IndexReader reader,
int docId,
String fieldName) |
protected String |
getFragmentSource(StringBuilder buffer,
int[] index,
Field[] values,
int startOffset,
int endOffset) |
protected String |
getFragmentSourceMSO(StringBuilder buffer,
int[] index,
Field[] values,
int startOffset,
int endOffset,
int[] modifiedStartOffset) |
char |
getMultiValuedSeparator() |
protected String |
getPostTag(int num) |
protected String |
getPostTag(String[] postTags,
int num) |
protected String |
getPreTag(int num) |
protected String |
getPreTag(String[] preTags,
int num) |
abstract List<FieldFragList.WeightedFragInfo> |
getWeightedFragInfoList(List<FieldFragList.WeightedFragInfo> src) |
boolean |
isDiscreteMultiValueHighlighting() |
protected String |
makeFragment(StringBuilder buffer,
int[] index,
Field[] values,
FieldFragList.WeightedFragInfo fragInfo,
String[] preTags,
String[] postTags,
Encoder encoder) |
void |
setDiscreteMultiValueHighlighting(boolean discreteMultiValueHighlighting) |
void |
setMultiValuedSeparator(char separator) |
protected String[] preTags
protected String[] postTags
public static final String[] COLORED_PRE_TAGS
public static final String[] COLORED_POST_TAGS
protected BaseFragmentsBuilder()
protected BaseFragmentsBuilder(BoundaryScanner boundaryScanner)
protected BaseFragmentsBuilder(String[] preTags, String[] postTags, BoundaryScanner boundaryScanner)
public abstract List<FieldFragList.WeightedFragInfo> getWeightedFragInfoList(List<FieldFragList.WeightedFragInfo> src)
public String createFragment(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList) throws IOException
FragmentsBuilder
createFragment
in interface FragmentsBuilder
reader
- IndexReader of the indexdocId
- document id to be highlightedfieldName
- field of the document to be highlightedfieldFragList
- FieldFragList objectIOException
- If there is a low-level I/O errorpublic String[] createFragments(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList, int maxNumFragments) throws IOException
FragmentsBuilder
createFragments
in interface FragmentsBuilder
reader
- IndexReader of the indexdocId
- document id to be highlighterfieldName
- field of the document to be highlightedfieldFragList
- FieldFragList objectmaxNumFragments
- maximum number of fragmentsIOException
- If there is a low-level I/O errorpublic String createFragment(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList, String[] preTags, String[] postTags, Encoder encoder) throws IOException
FragmentsBuilder
createFragment
in interface FragmentsBuilder
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 textIOException
- If there is a low-level I/O errorpublic String[] createFragments(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList, int maxNumFragments, String[] preTags, String[] postTags, Encoder encoder) throws IOException
FragmentsBuilder
createFragments
in interface FragmentsBuilder
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 textIOException
- If there is a low-level I/O errorprotected Field[] getFields(IndexReader reader, int docId, String fieldName) throws IOException
IOException
protected String makeFragment(StringBuilder buffer, int[] index, Field[] values, FieldFragList.WeightedFragInfo fragInfo, String[] preTags, String[] postTags, Encoder encoder)
protected String getFragmentSourceMSO(StringBuilder buffer, int[] index, Field[] values, int startOffset, int endOffset, int[] modifiedStartOffset)
protected String getFragmentSource(StringBuilder buffer, int[] index, Field[] values, int startOffset, int endOffset)
protected List<FieldFragList.WeightedFragInfo> discreteMultiValueHighlighting(List<FieldFragList.WeightedFragInfo> fragInfos, Field[] fields)
public void setMultiValuedSeparator(char separator)
public char getMultiValuedSeparator()
public boolean isDiscreteMultiValueHighlighting()
public void setDiscreteMultiValueHighlighting(boolean discreteMultiValueHighlighting)
protected String getPreTag(int num)
protected String getPostTag(int num)
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.