Search doesn't match accented characters when query has no accents.
Description
When using the locale setting on a field, Typesense search doesn't match queries without accents to documents containing accented characters. For example, searching "dipticos" doesn't find a document with title "Dípticos".
Current Behavior
When a field has locale: "es", the indexed text preserves diacritics. Search queries are matched literally, so "dipticos" ≠ "Dípticos" and "dip" ≠ "Díp".
Expected Behavior
Search should match accent-insensitively when using locale-aware fields. Searching "dipticos" should find "Dípticos".
Steps to Reproduce
1. Create a collection with locale enabled
{
"name": "products_es",
"fields": [
{ "name": "id", "type": "string" },
{ "name": "title", "type": "string", "sort": true, "infix": true, "locale": "es" },
{ "name": "keywords", "type": "string", "optional": true, "locale": "es" },
{ "name": "category", "type": "string", "sort": true, "infix": true, "locale": "es" }
]
}2. Index a document with accented characters
{
"id": "1",
"title": "Dípticos Personalizados",
"keywords": "",
"category": "Dípticos, Trípticos y Plegados"
}3. Search with an unaccented query
Search Parameters:
{
"q": "dipticos",
"query_by": "title,keywords,category",
"per_page": 20,
"sort_by": "_text_match:desc",
"collection": "products_es",
"prefix": false,
"infix": "always,off,fallback",
"text_match_type": "max_weight",
"query_by_weights": "4,3,1",
"prioritize_token_position": true,
"prioritize_num_matching_fields": false,
"exclude_fields": "out_of,search_time_ms",
"highlight_fields": "none",
"enable_highlight_v1": false
}4. Observe: No results returned
The document is not found because "dipticos" doesn't match "Dípticos".
5. Search with the accented query
{
"q": "dípticos",
"query_by": "title,keywords,category",
"per_page": 20,
"sort_by": "_text_match:desc",
"collection": "products_es",
"prefix": false,
"infix": "always,off,fallback",
"text_match_type": "max_weight",
"query_by_weights": "4,3,1",
"prioritize_token_position": true,
"prioritize_num_matching_fields": false,
"exclude_fields": "out_of,search_time_ms",
"highlight_fields": "none",
"enable_highlight_v1": false
}6. Observe: Document is found
This confirms the issue is accent-sensitivity in search matching.
Environment
- Typesense Version: 30.1
- Operating System: Linux
- Client: JavaScript (browser)
Use Case
This is a common requirement for multilingual e-commerce and content sites where:
- Product names contain accented characters (Spanish: "Dípticos", French: "Café", Portuguese: "Açaí")
- Users typically search without accents from their keyboards
Source: typesense/typesense