Class SearchOptions.Builder
-
- All Implemented Interfaces:
public final class SearchOptions.Builder
Builder for creating SearchOptions.
-
-
Constructor Summary
Constructors Constructor Description SearchOptions.Builder()
Creates a Builder with default configuration.
-
Method Summary
Modifier and Type Method Description SearchOptions.Builder
snippetLength(int snippetLength)
Sets the maximum number of preview characters (i.e. SearchOptions.Builder
maxSearchResults(int maxSearchResults)
Limits the maximum number of search results. SearchOptions.Builder
priorityPages(@NonNull() List<Range> priorityPages)
Sets a list of page index ranges for pages that should be searched first. SearchOptions.Builder
priorityPages(@NonNull() List<Range> priorityPages, boolean searchOnlyInPriorityPages)
Sets a list of page index ranges for pages that should be searched. SearchOptions.Builder
searchAnnotations(boolean searchAnnotationsTextEnabled)
Enables/disables searching in annotations contents in addition to page text. SearchOptions.Builder
compareOptions(@NonNull() EnumSet<CompareOptions> compareOptions)
Sets CompareOptions to control various aspects of text search such as case sensitivity or whether regular expression search is enabled. SearchOptions.Builder
compareOptions(@NonNull() Array<CompareOptions> compareOptions)
Sets CompareOptions to control various aspects of text search such as case sensitivity or whether regular expression search is enabled. SearchOptions
build()
Builds the search options. -
-
Constructor Detail
-
SearchOptions.Builder
SearchOptions.Builder()
Creates a Builder with default configuration.
-
-
Method Detail
-
snippetLength
@NonNull() SearchOptions.Builder snippetLength(int snippetLength)
Sets the maximum number of preview characters (i.e. the search result snippet length) that are extracted with every search result. Setting the snippet length to
0
turns off snippet extraction, which performs better and is thus recommended if no snippets are required. If the search term exceeds the snippet length, the resulting snippet may be longer than the configured snippet length.- Parameters:
snippetLength
- Maximum number of snippet characters.
-
maxSearchResults
@NonNull() SearchOptions.Builder maxSearchResults(int maxSearchResults)
Limits the maximum number of search results. By default this is limited to {@value * MAX_SEARCH_RESULTS} or to {@value MAX_SEARCH_RESULTS_LOW_MEM} on devices with little of RAM. To turn off limiting use UNLIMITED_SEARCH_RESULTS.
- Parameters:
maxSearchResults
- Maximum count of search results to return, or UNLIMITED_SEARCH_RESULTS to turn off limiting.
-
priorityPages
@NonNull() SearchOptions.Builder priorityPages(@NonNull() List<Range> priorityPages)
Sets a list of page index ranges for pages that should be searched first.
-
priorityPages
@NonNull() SearchOptions.Builder priorityPages(@NonNull() List<Range> priorityPages, boolean searchOnlyInPriorityPages)
Sets a list of page index ranges for pages that should be searched.
- Parameters:
searchOnlyInPriorityPages
-false
to search all pages after searching through priority pages first,true
to perform the search on priority pages only.
-
searchAnnotations
@NonNull() SearchOptions.Builder searchAnnotations(boolean searchAnnotationsTextEnabled)
Enables/disables searching in annotations contents in addition to page text.
- Parameters:
searchAnnotationsTextEnabled
-true
to enable searching annotation contents,false
to disable it.
-
compareOptions
@NonNull() SearchOptions.Builder compareOptions(@NonNull() EnumSet<CompareOptions> compareOptions)
Sets CompareOptions to control various aspects of text search such as case sensitivity or whether regular expression search is enabled.
CASE_INSENSITIVE, DIACRITIC_INSENSITIVE and SMART_SEARCH are used by default.
- Parameters:
compareOptions
- EnumSet of compare options to use.
-
compareOptions
@NonNull() SearchOptions.Builder compareOptions(@NonNull() Array<CompareOptions> compareOptions)
Sets CompareOptions to control various aspects of text search such as case sensitivity or whether regular expression search is enabled.
CASE_INSENSITIVE, DIACRITIC_INSENSITIVE and SMART_SEARCH are used by default.
- Parameters:
compareOptions
- Array listing all compare options to use.
-
build
@NonNull() SearchOptions build()
Builds the search options.
- Returns:
Search options built from the pre-defined values.
-
-
-
-