---
title: "PDF Search Matching Options on iOS | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/ios/search/indexed-full-text-search/matching-options/"
md_url: "https://www.nutrient.io/guides/ios/search/indexed-full-text-search/matching-options.md"
last_updated: "2026-05-23T00:08:18.127Z"
description: "Discover how to use PDFLibrary's advanced matching options for efficient document searches with customizable result limits and preview settings."
---

# PDF Search Matching Options on iOS

[`PDFLibrary`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary) offers advanced matching options. Pass these options in a `Dictionary` when calling [`documentUIDs(matching:options:completionHandler:previewTextHandler:)`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/documentuids(matching:options:completionhandler:previewtexthandler:)).

| Name                                    | Type      | Description                                                                                       |
| --------------------------------------- | --------- | ------------------------------------------------------------------------------------------------- |
| [`.maximumSearchResultsTotal`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/option/maximumsearchresultstotal)        | `UInt`    | The maximum amount of search results for the total of all documents. Defaults to 500.             |
| [`.maximumSearchResultsPerDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/option/maximumsearchresultsperdocument)  | `UInt`    | The maximum amount of search results per document.                                                |
| [`.maximumPreviewResultsTotal`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/option/maximumpreviewresultstotal)       | `UInt`    | The maximum amount of preview search results of all documents. Defaults to 500.                   |
| [`.maximumPreviewResultsPerDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/option/maximumpreviewresultsperdocument) | `UInt`    | The maximum amount of preview search results per document.                                        |
| [`.matchExactWordsOnly`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/option/matchexactwordsonly)              | `Bool`    | Only matches exact words. For example, “something” would not match “some.”                        |
| [`.matchExactPhrasesOnly`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/option/matchexactphrasesonly)            | `Bool`    | Only matches exact phrases. For example, “this is a test” would not match “this is a quick test.” |
| [`.excludeAnnotations`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/option/excludeannotations)               | `Bool`    | Excludes annotations from the search. By default, indexed annotations will be searched.           |
| [`.excludeDocumentText`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/option/excludedocumenttext)              | `Bool`    | Excludes document text from the search. By default, indexed document text will be searched.       |
| [`.previewRange`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/option/previewrange)                     | `NSRange` | The range of the preview string. Defaults to 20/160.                                              |

## Advanced Configuration

You can configure [`PDFLibrary`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary) to match your needs. The following properties on [`PDFLibrary`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary) are available.

| Property                     | Type      | Default | Description                                                                                                                                                                   |
| ---------------------------- | --------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`tokenizer`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/tokenizer)              | `String?` | `nil`   | The tokenizer used by the library. `nil` means PSPDFKit’s Porter tokenizer is used. You can learn more about this advanced topic by reading the [custom tokenizers](https://www.nutrient.io/guides/ios/memory-and-storage/using-custom-tokenizers.md) guide.  |
| [`saveReversedPageText`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/savereversedpagetext)   | `Bool`    | `true`  | This indicates whether or not the reversed text of a PDF document should be saved. This increases the size of the cache by about two, but it allows for “ends with” searches. |
| [`shouldIndexAnnotations`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/shouldindexannotations) | `Bool`    | `true`  | This specifies whether contents of annotations in documents should be indexed as well.                                                                                        |

You can also create your own instance of [`PDFLibrary`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary). Use [`PDFLibrary(path:)`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/init(path:)) to create a new instance. `path` must be the path to an empty directory. If `path` doesn’t yet exist, the library will create it for you. The SQLite database cache will be stored there. Subsequent calls to [`PDFLibrary(path:)`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pdflibrary/init(path:)) will always return the same object.
---

## Related pages

- [Adding a Custom SQLite Library for PDF Search on iOS](/guides/ios/miscellaneous/custom-sqlite-library.md)
- [Indexing PDF Documents on iOS](/guides/ios/features/indexed-full-text-search.md)
- [Custom Tokenizers for PDF Search on iOS](/guides/ios/memory-and-storage/using-custom-tokenizers.md)
- [Generate PDF Search Previews on iOS](/guides/ios/search/indexed-full-text-search/customize-results.md)
- [Encrypt the PDF Search Database on iOS](/guides/ios/security/encryption-in-pdflibrary.md)
- [Index and Search PDFs Using iOS Spotlight](/guides/ios/search/indexed-full-text-search/spotlight-indexing.md)

