Hey Team, I am sorry for asking this, this seems ...
# community-help
d
Hey Team, I am sorry for asking this, this seems too easy, but I am blocked for some time now implementing the desired behaviour. 😅 I have a collection called "Locations" where I have 100k+ German cities. The issue we are having is that if a user tries to find "München" he can either type "München" which will return the correct document but if they type "munchen" it will not find the document. Is there a way to handle accents automatically or do I need a new property in the schema where I have an array with normalised names? The typo mismatch is working as expected as long as the "ü" is present.
k
Hi Dave, can you please tell me what locale you are using for the field that stores this text?
d
here is my schema:
Copy code
{
  "created_at": 1749100813,
  "default_sorting_field": "",
  "enable_nested_fields": false,
  "fields": [
    {
      "facet": false,
      "index": true,
      "infix": true,
      "locale": "en",
      "name": "city_en",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": true,
      "locale": "de",
      "name": "city_de",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": true,
      "locale": "fr",
      "name": "city_fr",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": true,
      "locale": "it",
      "name": "city_it",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": true,
      "locale": "nl",
      "name": "city_nl",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": false,
      "locale": "en",
      "name": "parent_city_en",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": false,
      "locale": "de",
      "name": "parent_city_de",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": false,
      "locale": "fr",
      "name": "parent_city_fr",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": false,
      "locale": "it",
      "name": "parent_city_it",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": false,
      "locale": "nl",
      "name": "parent_city_nl",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": false,
      "locale": "",
      "name": "coordinates",
      "optional": true,
      "sort": true,
      "stem": false,
      "store": true,
      "type": "geopoint"
    },
    {
      "facet": false,
      "index": true,
      "infix": false,
      "locale": "",
      "name": "Search",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": false,
      "locale": "",
      "name": "ParentSearch",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "string"
    },
    {
      "facet": false,
      "index": true,
      "infix": false,
      "locale": "",
      "name": "isParent",
      "optional": false,
      "sort": false,
      "stem": false,
      "store": true,
      "type": "bool"
    },
    {
      "facet": false,
      "index": true,
      "infix": false,
      "locale": "",
      "name": "sortIdx",
      "optional": false,
      "sort": true,
      "stem": false,
      "store": true,
      "type": "int32"
    }
  ],
  "name": "Locations",
  "num_documents": 127202,
  "symbols_to_index": [],
  "token_separators": [
    "-"
  ]
}
as you can see i have multiple languages for the city, setting the correct locale
i am querying for "city_{lang_code}"
k
So I think there are pros and cons of using the
de
locale. Without
de
the
ü
will be decoded as
u
during both indexing and search so it will work for both forms. With
de
we don't do that and since the unicode bytes of
ü
is > 2, typo correction doesn't help.
d
You are saying that it is worth checking removing the locale and using the default 'en' locale?
k
Yes
d
okay thank you!
🙌 1