Interface FragmentsBuilder
-
- All Known Implementing Classes:
BaseFragmentsBuilder,ScoreOrderFragmentsBuilder,SimpleFragmentsBuilder
public interface FragmentsBuilderFragmentsBuilderis an interface for fragments (snippets) builder classes. AFragmentsBuilderclass can be plugged in toFastVectorHighlighter.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringcreateFragment(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList)create a fragment.StringcreateFragment(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.
-
-
-
Method Detail
-
createFragment
String createFragment(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList) throws IOException
create a fragment.- 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:
IOException- If there is a low-level I/O error
-
createFragments
String[] createFragments(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList, int maxNumFragments) throws IOException
create multiple fragments.- 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:
IOException- If there is a low-level I/O error
-
createFragment
String createFragment(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList, String[] preTags, String[] postTags, Encoder encoder) throws IOException
create a fragment.- 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:
IOException- If there is a low-level I/O error
-
createFragments
String[] createFragments(IndexReader reader, int docId, String fieldName, FieldFragList fieldFragList, int maxNumFragments, String[] preTags, String[] postTags, Encoder encoder) throws IOException
create multiple fragments.- 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:
IOException- If there is a low-level I/O error
-
-