HighlightOptions

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:

Constructors

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.

Methods

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.

HighlightOptions()

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.

HighlightOptions(int maxLength)

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.

HighlightOptions(Integer maxLength, boolean isLineLimited)

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.

HighlightOptions(Integer maxLength, int wordCount)

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.

HighlightOptions(Integer maxLength, Integer wordCount, boolean isLineLimited)

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.

getMaxLength()

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.

getWordCount()

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.

isLineLimited()

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 .

setMaxLength(Integer maxLength)

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.

setWordCount(Integer wordCount)

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.

setLineLimited(boolean lineLimited)

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.