Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo tolerance disableOnAttributes ineffective for attributes with similar content #4256

Closed
Florian86 opened this issue Dec 14, 2023 · 1 comment
Labels
bug Something isn't working as expected v1.6.0 PRs/issues solved in v1.6.0 released on 2024-01-15
Milestone

Comments

@Florian86
Copy link

Hey, I'm having trouble configuring/understanding the typo tolerance setting disableOnAttributes. Not sure if this is a bug or just behavior that I don't understand.

I added the following documents:

[
  {
    "id": "1",
    "attr1": "Meilisearch",
    "attr2": "hello Meilisearch"
  },
  {
    "id": "2",
    "attr1": "Meilisearch",
    "attr2": "foobar"
  }
]

With default configuration I see the following result when searching for Meilisearch:

{
  "hits": [
    {
      "id": "1",
      "attr1": "Meilisearch",
      "attr2": "hello Meilisearch",
    },
    {
      "id": "2",
      "attr1": "Meilisearch",
      "attr2": "foobar"
    }
  ],
  "query": "Meilisearch",
}

Searching for Meilisearcx results in:

{
  "hits": [
    {
      "attr1": "Meilisearch",
      "attr2": "hello Meilisearch",
      "id": "1"
    },
    {
      "attr1": "Meilisearch",
      "attr2": "foobar",
      "id": "2"
    }
  ],
  "query": "Meilisearcx",
}

Everything as expected so far.

When limiting the searchable attributes to attr1 and disabling typo tolerance on attr1, the results change as expected.
Searching for Meilisearch => 2 hits.
Searching for Meilisearcx => 0 hits.

Now I add attr2 to searchable attributes and disable typo tolerance on attr2 as well.

{
  "enabled": true,
  "minWordSizeForTypos": {
    "oneTypo": 5,
    "twoTypos": 9
  },
  "disableOnWords": [],
  "disableOnAttributes": [
    "attr1",
    "attr2"
  ]
}

Searching for Meilisearch => 2 hits, as expected.

But when searching for Meilisearcx, I would have expected to get no results. Instead, I get one hit, although typo tolerance is disabled on attr1 and attr2:

{
  "hits": [
    {
      "attr1": "Meilisearch",
      "attr2": "hello Meilisearch",
      "id": "1"
    }
  ],
  "query": "Meilisearcx",
}

When changing the documents to:

[
  {
    "id": "1",
    "attr1": "Meilisearch",
    "attr2": "something else"
  },
  {
    "id": "2",
    "attr1": "Meilisearch",
    "attr2": "foobar"
  }
]

I do not get any results, as I would expect.

So in short: Disabling typo tolerance on two attributes that have similar content does not seem to work.

Meilisearch version: v1.5.1

@ManyTheFish ManyTheFish added this to the v1.6.0 milestone Dec 19, 2023
@ManyTheFish
Copy link
Member

Hello @Florian86,
Indeed, it's a bug,
I reproduced the bug on v1.5.0 and v1.5.1.
However, the bug doesn't seem to appear on the main branch (future v1.6.0).
So this bug should be fixed in the next release (v1.6.0).

The first release candidate has already been released; don't hesitate to try it:
https://github.com/meilisearch/meilisearch/releases

If you manage to reproduce the bug with the release candidate,
please reopen the issue, and we'll make further investigation,

Thank you for the report!
see you!

Closing this issue as fixed in v1.6.0

@ManyTheFish ManyTheFish added the bug Something isn't working as expected label Dec 19, 2023
@meili-bot meili-bot added the v1.6.0 PRs/issues solved in v1.6.0 released on 2024-01-15 label Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected v1.6.0 PRs/issues solved in v1.6.0 released on 2024-01-15
Projects
None yet
Development

No branches or pull requests

3 participants