Skip to main content
This parameter controls if Algolia considers matches with typos when searching, and how aggressively. To learn more, see Configuring typo tolerance.

Usage

By default, Algolia matches query terms at the beginning of words in your records (prefix matching). For alternatives, see Match queries in the middle or end of words.

Options

true | "true"
Typo tolerance is enabled for all attributes and query words (default behavior). Accepts both true (boolean) and "true" (string). Also enables splitting and concatenation.
false | "false"
Typo tolerance is off. Only exact matches will be returned. Accepts both false (boolean) and "false" (string).
min
Applies typo tolerance but returns only the records with the fewest typos. For example, if results include matches with one and two typos, only those with one typo are returned. Also enables splitting and concatenation.
strict
Like "min", but includes results with the fewest and second fewest typos. Also forces the Typo ranking criterion to be evaluated first in the ranking formula. Also enables splitting and concatenation.

Examples

Set default typo tolerance mode

Current API clients

var response = await client.SetSettingsAsync(
  "INDEX_NAME",
  new IndexSettings { TypoTolerance = new TypoTolerance(true) }
);
final response = await client.setSettings(
  indexName: "INDEX_NAME",
  indexSettings: IndexSettings(
    typoTolerance: true,
  ),
);
response, err := client.SetSettings(client.NewApiSetSettingsRequest(
  "INDEX_NAME",
  search.NewEmptyIndexSettings().SetTypoTolerance(search.BoolAsTypoTolerance(true))))
if err != nil {
  // handle the eventual error
  panic(err)
}
UpdatedAtResponse response = client.setSettings("INDEX_NAME", new IndexSettings().setTypoTolerance(TypoTolerance.of(true)));
const response = await client.setSettings({ indexName: 'theIndexName', indexSettings: { typoTolerance: true } });
var response =
  client.setSettings(
    indexName = "INDEX_NAME",
    indexSettings = IndexSettings(typoTolerance = TypoTolerance.of(true)),
  )
$response = $client->setSettings(
    'INDEX_NAME',
    ['typoTolerance' => true,
    ],
);
response = client.set_settings(
    index_name="INDEX_NAME",
    index_settings={
        "typoTolerance": True,
    },
)
response = client.set_settings("INDEX_NAME", Algolia::Search::IndexSettings.new(typo_tolerance: true))
val response = Await.result(
  client.setSettings(
    indexName = "INDEX_NAME",
    indexSettings = IndexSettings(
      typoTolerance = Some(TypoTolerance(true))
    )
  ),
  Duration(100, "sec")
)
let response = try await client.setSettings(
    indexName: "INDEX_NAME",
    indexSettings: IndexSettings(typoTolerance: SearchTypoTolerance.bool(true))
)
IndexSettings settings = new IndexSettings();
settings.TypoTolerance = true;
// settings.TypoTolerance = false;
// settings.TypoTolerance = "min";
// settings.TypoTolerance = "strict";
res, err := index.SetSettings(search.Settings{
	TypoTolerance: opt.TypoTolerance(true),
	// TypoTolerance: opt.TypoTolerance(false),
	// TypoTolerance: opt.TypoToleranceMin(),
	// TypoTolerance: opt.TypoToleranceStrict(),
})
index.setSettings(
  new IndexSettings().setTypoTolerance(TypoTolerance.of(true))
  // new IndexSettings().setTypoTolerance(TypoTolerance.of(false))
  // new IndexSettings().setTypoTolerance(TypoTolerance.of("min"))
  // new IndexSettings().setTypoTolerance(TypoTolerance.of("strict"))
);
index
  .setSettings({
    typoTolerance: true,
    // typoTolerance: false
    // typoTolerance: 'min'
    // typoTolerance: 'strict'
  })
  .then(() => {
    // done
  });
val settings = settings {
    typoTolerance = TypoTolerance.True
    // typoTolerance = TypoTolerance.False
    // typoTolerance = TypoTolerance.Min
    // typoTolerance = TypoTolerance.Strict
}

index.setSettings(settings)
$index->setSettings([
  'typoTolerance' => true
  // 'typoTolerance' => false
  // 'typoTolerance' => 'min'
  // 'typoTolerance' => 'strict'
]);
index.set_settings(
    {
        "typoTolerance": True
        # 'typoTolerance': False
        # 'typoTolerance': 'min'
        # 'typoTolerance': 'strict'
    }
)
index.set_settings(
  {
    typoTolerance: true
    # typoTolerance: false
    # typoTolerance: 'min'
    # typoTolerance: 'strict'
  }
)
client.execute {
  setSettings of "myIndex" `with` IndexSettings(
    typoTolerance = Some(TypoTolerance.`true`)
    // typoTolerance = Some(TypoTolerance.`false`)
    // typoTolerance = Some(TypoTolerance.min)
    // typoTolerance = Some(TypoTolerance.strict)
  )
}
let settings = Settings()
  .set(\.typoTolerance, to: true)
//.set(\.typoTolerance, to: false)
//.set(\.typoTolerance, to: .min)
//.set(\.typoTolerance, to: .strict)

index.setSettings(settings) { result in
  if case .success(let response) = result {
    print("Response: \(response)")
  }
}

Current API clients

var response = await client.SearchSingleIndexAsync<Hit>(
  "INDEX_NAME",
  new SearchParams(
    new SearchParamsObject { Query = "query", TypoTolerance = new TypoTolerance(false) }
  )
);
final response = await client.searchSingleIndex(
  indexName: "INDEX_NAME",
  searchParams: SearchParamsObject(
    query: "query",
    typoTolerance: false,
  ),
);
response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(
  "INDEX_NAME").WithSearchParams(search.SearchParamsObjectAsSearchParams(
  search.NewEmptySearchParamsObject().SetQuery("query").SetTypoTolerance(search.BoolAsTypoTolerance(false)))))
if err != nil {
  // handle the eventual error
  panic(err)
}
SearchResponse response = client.searchSingleIndex(
  "INDEX_NAME",
  new SearchParamsObject().setQuery("query").setTypoTolerance(TypoTolerance.of(false)),
  Hit.class
);
const response = await client.searchSingleIndex({
  indexName: 'indexName',
  searchParams: { query: 'query', typoTolerance: false },
});
var response =
  client.searchSingleIndex(
    indexName = "INDEX_NAME",
    searchParams = SearchParamsObject(query = "query", typoTolerance = TypoTolerance.of(false)),
  )
$response = $client->searchSingleIndex(
    'INDEX_NAME',
    ['query' => 'query',
        'typoTolerance' => false,
    ],
);
response = client.search_single_index(
    index_name="INDEX_NAME",
    search_params={
        "query": "query",
        "typoTolerance": False,
    },
)
response = client.search_single_index(
  "INDEX_NAME",
  Algolia::Search::SearchParamsObject.new(query: "query", typo_tolerance: false)
)
val response = Await.result(
  client.searchSingleIndex(
    indexName = "INDEX_NAME",
    searchParams = Some(
      SearchParamsObject(
        query = Some("query"),
        typoTolerance = Some(TypoTolerance(false))
      )
    )
  ),
  Duration(100, "sec")
)
let response: SearchResponse<Hit> = try await client.searchSingleIndex(
    indexName: "INDEX_NAME",
    searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(
        query: "query",
        typoTolerance: SearchTypoTolerance.bool(false)
    ))
)
index.Search(new Query("query")
{
    TypoTolerance = true
    // TypoTolerance = false
    // TypoTolerance = "min"
    // TypoTolerance = "strict"
});
res, err := index.Search(
	"query",
	opt.TypoTolerance(false),
	// opt.TypoTolerance(true),
	// opt.TypoToleranceMin(),
	// opt.TypoToleranceStrict(),
)
index.search(
  new Query("").setTypoTolerance(TypoTolerance.of(false))
  // new Query("").setTypoTolerance(TypoTolerance.of(true)))
  // new Query("").setTypoTolerance(TypoTolerance.of("min"))
  // new Query("").setTypoTolerance(TypoTolerance.of("strict"))
);
index
  .search("query", {
    typoTolerance: false,
    // 'typoTolerance': true
    // 'typoTolerance': 'min'
    // 'typoTolerance': 'strict'
  })
  .then(({ hits }) => {
    console.log(hits);
  });
val query = query("query") {
    typoTolerance = TypoTolerance.True
    // typoTolerance = TypoTolerance.False
    // typoTolerance = TypoTolerance.Min
    // typoTolerance = TypoTolerance.Strict
}

index.search(query)
$results = $index->search('query', [
  'typoTolerance' => false
  // 'typoTolerance' => true
  // 'typoTolerance' => 'min'
  // 'typoTolerance' => 'strict'
]);
results = index.search(
    "query",
    {
        "typoTolerance": False
        # 'typoTolerance': True
        # 'typoTolerance': 'min'
        # 'typoTolerance': 'strict'
    },
)
results = index.search(
  "query",
  {
    typoTolerance: false
    # typoTolerance: true
    # typoTolerance: 'min'
    # typoTolerance: 'strict'
  }
)
client.execute {
  search into "myIndex" query Query(
    query = Some("query"),
    typoTolerance = Some(TypoTolerance.`false`)
    // typoTolerance = Some(TypoTolerance.`true`)
    // typoTolerance = Some(TypoTolerance.min)
    // typoTolerance = Some(TypoTolerance.strict)
  )
}
let query = Query("query")
  .set(\.typoTolerance, to: false)
  //.set(\.typoTolerance, to: true)
  //.set(\.typoTolerance, to: .min)
  //.set(\.typoTolerance, to: .strict)

index.search(query: query) { result in
  if case .success(let response) = result {
    print("Response: \(response)")
  }
}
Last modified on May 19, 2026