HighlightOptions
Leave feedback
On this page
Inheritance: java.lang.Object
public class HighlightOptions
Provides the options which are used to extract a highlight (a block of text aroud found text in search scenarios).
An instance of HighlightOptions class is used as parameter in Parser.getHighlight(int, boolean, HighlightOptions) method. See the usage examples there.
Learn more:
| Constructor | Description |
|---|---|
| HighlightOptions() | Initializes a new instance of the HighlightOptions class with no limits set. |
| HighlightOptions(int maxLength) | Initializes a new instance of the HighlightOptions class which is used to extract a fixed-length highlight. |
| HighlightOptions(Integer maxLength, boolean isLineLimited) | Initializes a new instance of the HighlightOptions class which is used to extract a line-limited highlight. |
| HighlightOptions(Integer maxLength, int wordCount) | Initializes a new instance of the HighlightOptions class which is used to extract a highlight with the fixed word count. |
| HighlightOptions(Integer maxLength, Integer wordCount, boolean isLineLimited) | Initializes a new instance of the HighlightOptions class. |
| Method | Description |
|---|---|
| getMaxLength() | Gets a maximum text length. |
| getWordCount() | Gets a maximum word count. |
| isLineLimited() | Gets value that indicates whether highlight extraction is limited by the start (or the end) of a text line. |
| setMaxLength(Integer maxLength) | Sets a maximum text length. |
| setWordCount(Integer wordCount) | Sets a maximum word count. |
| setLineLimited(boolean lineLimited) | Sets the value that indicates whether highlight extraction is limited by the start (or the end) of a text line. |
public HighlightOptions()
Initializes a new instance of the HighlightOptions class with no limits set. Set at least one of #setMaxLength(Integer).setMaxLength(Integer), #setWordCount(Integer).setWordCount(Integer), #setLineLimited(boolean).setLineLimited(boolean) before passing to the parser.
public HighlightOptions(int maxLength)
Initializes a new instance of the HighlightOptions class which is used to extract a fixed-length highlight.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| maxLength | int | The maximum text length. |
public HighlightOptions(Integer maxLength, boolean isLineLimited)
Initializes a new instance of the HighlightOptions class which is used to extract a line-limited highlight.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| maxLength | java.lang.Integer | The maximum text length. |
| isLineLimited | boolean | The value that indicates whether the highlight extraction is limited by the start (or the end) of a text line. |
public HighlightOptions(Integer maxLength, int wordCount)
Initializes a new instance of the HighlightOptions class which is used to extract a highlight with the fixed word count.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| maxLength | java.lang.Integer | The maximum text length. |
| wordCount | int | The maximum word count. |
public HighlightOptions(Integer maxLength, Integer wordCount, boolean isLineLimited)
Initializes a new instance of the HighlightOptions class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| maxLength | java.lang.Integer | The maximum text length. |
| wordCount | java.lang.Integer | The maximum word count. |
| isLineLimited | boolean | The value that indicates whether the highlight extraction is limited by the start (or the end) of a text line. |
public Integer getMaxLength()
Gets a maximum text length.
Returns: java.lang.Integer - A positive integer value that represents the maximum text length; null if the text length isn’t limited.
public Integer getWordCount()
Gets a maximum word count.
Returns: java.lang.Integer - A positive integer value that represents the maximum word count; null if the word count isn’t limited.
public boolean isLineLimited()
Gets value that indicates whether highlight extraction is limited by the start (or the end) of a text line.
Returns: boolean - true if highlight extraction is limited by the start (or the end) of a text line; otherwise, false .
public void setMaxLength(Integer maxLength)
Sets a maximum text length.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| maxLength | java.lang.Integer | A non-negative integer; null to remove the length limit. |
public void setWordCount(Integer wordCount)
Sets a maximum word count.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| wordCount | java.lang.Integer | A non-negative integer; null to remove the word-count limit. |
public void setLineLimited(boolean lineLimited)
Sets the value that indicates whether highlight extraction is limited by the start (or the end) of a text line.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| lineLimited | boolean | true to limit by line bounds. |
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.