public static final class

SearchOptions.Builder

extends Object
java.lang.Object
   ↳ com.pspdfkit.document.search.SearchOptions.Builder

Class Overview

Builder for creating SearchOptions.

Summary

Public Constructors
Builder(Context context)
This constructor is deprecated. Use Builder() instead.
Builder()
Creates a SearchOptions.Builder with default configuration.
Public Methods
SearchOptions build()
Builds the search options.
SearchOptions.Builder compareOptions(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(CompareOptions... compareOptions)
Sets CompareOptions to control various aspects of text search such as case sensitivity or whether regular expression search is enabled.
SearchOptions.Builder maxSearchResults(int maxSearchResults)
Limits the maximum number of search results.
SearchOptions.Builder priorityPages(List<Range> priorityPages)
Sets a list of page index ranges for pages that should be searched first.
SearchOptions.Builder priorityPages(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 snippetLength(int snippetLength)
Sets the maximum number of preview characters (i.e.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Builder (Context context)

This constructor is deprecated.
Use Builder() instead.

Creates a SearchOptions.Builder with default configuration.

public Builder ()

Creates a SearchOptions.Builder with default configuration.

Public Methods

public SearchOptions build ()

Builds the search options.

Returns
  • Search options built from the pre-defined values.

public SearchOptions.Builder compareOptions (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.

public SearchOptions.Builder compareOptions (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.

public 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.

public SearchOptions.Builder priorityPages (List<Range> priorityPages)

Sets a list of page index ranges for pages that should be searched first.

public SearchOptions.Builder priorityPages (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.

public 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.

public 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. Defaults to {@value #DEFAULT_SNIPPET_LENGTH}. May be 0 to turn off snippet extraction.