Loving Tina? us on GitHub0.0k

Docs

Learn

v.Latest
Documentation

Search Overview

Loading last updated info...
On This Page

TinaCMS provides built-in search functionality for content. This is useful for allowing editors to quickly finding content in a site. TinaCloud's content search is powered by Fergus McDowall's search-index library.

Note: Search is not currently supported in self-hosted Tina.

Configuration

To enable search functionality, you will need to populate the search field in your Tina configuration. The only required element of the search configuration when using TinaCloud search is the search.tina.indexerToken field. This can be obtained from the TinaCloud dashboard for the project.

export default defineConfig({
//...
schema: {
collections: [
// Array of collections
],
},
search: {
tina: {
indexerToken: '<Your Search Token>',
stopwordLanguages: ['eng'],
},
indexBatchSize: 100,
maxSearchIndexFieldLength: 100,
},
//.. Other config
})

Definition

Property

Description

search.tina.indexerToken

TinaCloud search token (required)

search.tina.stopwordLanguages

Optional array of string stopword languages. Defaults to ['eng']. See the stopword GitHub repository for a full list of supported languages.

search.tina.fuzzyEnabled

Enable or disable fuzzy search globally. Defaults to true.

search.tina.fuzzyOptions.maxDistance

Maximum edit distance for fuzzy matching (0-10). Higher values find more distant matches but may return less relevant results. Defaults to 2.

search.tina.fuzzyOptions.minSimilarity

Minimum similarity score (0-1) required for a match. Higher values return more precise matches. Defaults to 0.6.

search.tina.fuzzyOptions.maxTermExpansions

Maximum number of similar terms to consider per search word (1-100). Defaults to 10.

search.tina.fuzzyOptions.useTranspositions

Allow character transpositions (e.g., "teh" → "the") using Damerau-Levenshtein algorithm. Defaults to true.

search.indexBatchSize

Used by the indexing process to determine the number of documents to index per request. Defaults to 100.

search.maxSearchIndexFieldLength

For variable length text fields, this controls how much of the text is considered when indexing. A higher value will increase the indexing time and size of the search index. Defaults to 100 characters.

Building the search index

Development

When search is configured and a site is running locally with the dev command, content will be automatically indexed at startup. Any changes to local content will also trigger updates to the (local) search index.

Production

When search is configured and a site is being built for production using the build command, the search index will be automatically created and uploaded to TinaCloud. Each Git branch for your site has a separate search index.

Note that the search index is "live" once the site is built, so any newly added or removed content may be reflected in the search index before the site has been deployed. Building the search index can be skipped by passing the --skip-search-index cli option to the build command. Then the search-index command can be run separately once the site deployment completes.

Customizing search indexing

Excluding fields

By default, all collection field types (except image) are including in the search index. You can improve discoverability of content by controlling which fields are included in the search index. This is done by setting the optional searchable property on fields in the collection schema. For example, to disable indexing for an author field, use something like:

// ...
fields: [
// ...
{
label: 'Author',
name: 'author',
type: 'reference',
collections: ['author'],
searchable: false, // Disable indexing of the author field
},
]
//

Limiting text fields

By default, only the first 100 characters of a text field are used when building the search index. This can be adjusted globally in the search configuration (see above), but can also be done on a per field basis like so:

// ...
fields: [
// ...
{
label: 'Post Body',
name: 'body',
type: 'string',
maxSearchIndexFieldLength: 50, // Only index the first 50 characters of this field
},
]
//

TinaCMS includes built-in fuzzy search capabilities that help users find content even when they make typos or spelling mistakes. Fuzzy search is enabled by default, so your search will automatically handle common misspellings without any additional configuration.

Fuzzy search was released in tinacms@3.3.0 and @tinacms/cli@2.1.0. No config changes are needed to get the benefits of the new search — just update your packages!

How Fuzzy Search Works

Fuzzy search finds terms in your content that are "similar" to what the user typed, even if they don't match exactly. TinaCMS uses the Damerau-Levenshtein distance algorithm, which measures similarity by counting the minimum number of single-character edits needed to transform one word into another.

Supported edit operations:

Operation

Example

Edits

Insertion

"rect" → "react"

1

Deletion

"reactt" → "react"

1

Substitution

"reect" → "react"

1

Transposition

"raect" → "react"

1 (swapping adjacent characters)

When a user searches, each word in their query is expanded to include similar terms from your indexed content. For example, searching "Raect tutrial" would also match documents containing "React tutorial".

Configuration

Fuzzy search works out of the box with sensible defaults. You can customize its behavior by adding fuzzyOptions to your search configuration:

export default defineConfig({
//...
search: {
tina: {
indexerToken: '<Your Search Token>',
stopwordLanguages: ['eng'],
fuzzyEnabled: true, // enabled by default
fuzzyOptions: {
maxDistance: 2, // max edit distance (0-10)
minSimilarity: 0.6, // min similarity score (0-1)
maxTermExpansions: 10, // max similar terms per word
useTranspositions: true, // allow letter swaps
},
},
},
//...
})

Examples

Here are examples of typos that fuzzy search will catch with the default settings:

// Single character errors
"Raect" → matches "React"
"TypeScrpt" → matches "TypeScript"
"Javscript" → matches "JavaScript"
// Transposed letters
"teh" → matches "the"
"freind" → matches "friend"
// Multi-word queries with typos
"Raect tutrial" → matches "React tutorial"
"TypeScrpt developmnt" → matches "TypeScript development"

If you prefer exact matching only, you can disable fuzzy search:

export default defineConfig({
//...
search: {
tina: {
indexerToken: '<Your Search Token>',
fuzzyEnabled: false, // Disable fuzzy search
},
},
//...
})

Performance Tips

Fuzzy search includes automatic caching for repeated queries. If you need to optimize performance further, consider these adjustments:

Adjustment

Effect

Lower maxDistance (e.g., 1)

Faster searches, fewer false positives, but may miss some typos

Higher minSimilarity (e.g., 0.8)

More precise matches, fewer irrelevant results

Lower maxTermExpansions (e.g., 5)

Faster searches with large indexes

Example configuration for stricter, faster matching:

fuzzyOptions: {
maxDistance: 1, // Only 1 edit allowed
minSimilarity: 0.8, // 80% similarity required
maxTermExpansions: 5, // Fewer term expansions
}

Troubleshooting

Issue

Solution

Search returns too many irrelevant results

Increase minSimilarity to 0.7 or 0.8, or decrease maxDistance to 1

Search doesn't find results with typos

Ensure fuzzyEnabled is true (default). Try increasing maxDistance to 3

Search feels slow

Reduce maxTermExpansions and maxDistance. Consider lowering maxSearchIndexFieldLength

Want exact matching only

Set fuzzyEnabled: false

Alternative Search Providers

Currently only TinaCloud's search API is supported but we plan to provide alternative providers in the near future, as well as documentation for implementing custom search providers. If you'd like support for a specific search provider, let us know.

Last Edited: September 18, 2025