public final class SearchHighlightOptions extends Object
Provides options of highlight.
SearchHighlightOptions class is used to define highlight extraction in search results. Instead of HighlightOptions
SearchHighlightOptions class contains the information of two highlights - the left highlight (a text on the left side of the found text) and
the right highlight (a text on the left side of the found text).
The highlight size can be set in characters, words count and to line's start (end). Highlight starts from the start (for the left) or end (for the right) of the found text.
Modifier and Type | Field and Description |
---|---|
static SearchHighlightOptions |
EMPTY
Gets an empty instance.
|
Modifier and Type | Method and Description |
---|---|
static SearchHighlightOptions |
createFixedLengthOptions(int length)
Creates an instance of
SearchHighlightOptions for highlight extraction with the fixed length. |
static SearchHighlightOptions |
createFixedLengthOptions(int leftLength,
int rightLength)
Creates an instance of
SearchHighlightOptions for highlight extraction with the fixed length. |
static SearchHighlightOptions |
createLineOptions()
Creates an instance of
SearchHighlightOptions for highlight extraction to line's start (end). |
static SearchHighlightOptions |
createLineOptions(int maxLength)
Creates an instance of
SearchHighlightOptions for highlight extraction to line's start (end). |
static SearchHighlightOptions |
createLineOptions(int leftMaxLength,
int rightMaxLength)
Creates an instance of
SearchHighlightOptions for highlight extraction to line's start (end). |
static SearchHighlightOptions |
createWordsCountOptions(int wordsCount)
Creates an instance of
SearchHighlightOptions for highlight extraction with the limited words count. |
static SearchHighlightOptions |
createWordsCountOptions(int leftWordsCount,
int rightWordsCount)
Creates an instance of
SearchHighlightOptions for highlight extraction with the limited words count. |
int |
getHighlightMode()
Gets a mode of highlight extraction.
|
int |
getLeftLength()
Gets a length of the left highlight.
|
int |
getRightLength()
Gets a length of the right highlight.
|
public static final SearchHighlightOptions EMPTY
Gets an empty instance.
public int getHighlightMode()
Gets a mode of highlight extraction.
public int getLeftLength()
Gets a length of the left highlight.
public int getRightLength()
Gets a length of the right highlight.
public static SearchHighlightOptions createFixedLengthOptions(int length)
Creates an instance of SearchHighlightOptions
for highlight extraction with the fixed length.
length
- The value of length of the left and right highlight.SearchHighlightOptions
.public static SearchHighlightOptions createFixedLengthOptions(int leftLength, int rightLength)
Creates an instance of SearchHighlightOptions
for highlight extraction with the fixed length.
leftLength
- The value of length of the left highlight.rightLength
- The value of length of the right highlight.SearchHighlightOptions
.public static SearchHighlightOptions createWordsCountOptions(int wordsCount)
Creates an instance of SearchHighlightOptions
for highlight extraction with the limited words count.
wordsCount
- The value of words count of the left and right highlight.SearchHighlightOptions
.public static SearchHighlightOptions createWordsCountOptions(int leftWordsCount, int rightWordsCount)
Creates an instance of SearchHighlightOptions
for highlight extraction with the limited words count.
leftWordsCount
- The value of words count of the left highlight.rightWordsCount
- The value of words count of the right highlight.SearchHighlightOptions
.public static SearchHighlightOptions createLineOptions()
Creates an instance of SearchHighlightOptions
for highlight extraction to line's start (end).
SearchHighlightOptions
.public static SearchHighlightOptions createLineOptions(int maxLength)
Creates an instance of SearchHighlightOptions
for highlight extraction to line's start (end).
maxLength
- The value of maximum length of the left and right highlight.SearchHighlightOptions
.public static SearchHighlightOptions createLineOptions(int leftMaxLength, int rightMaxLength)
Creates an instance of SearchHighlightOptions
for highlight extraction to line's start (end).
leftMaxLength
- The value of maximum length of the left highlight.rightMaxLength
- The value of maximum length of the right highlight.SearchHighlightOptions
.Copyright © 2019. All rights reserved.