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 prefix search not working as expected #797

Closed
naira-petrosyan-m opened this issue Sep 26, 2024 · 2 comments
Closed

Typo tolerance prefix search not working as expected #797

naira-petrosyan-m opened this issue Sep 26, 2024 · 2 comments

Comments

@naira-petrosyan-m
Copy link

Describe the bug

I have this docs:

[{
    name: "S"
}, 
{
    name: "Scroll"
}]

When I search for "scrol" with typo tolerance of 1, I expect to have only one result "Scroll", instead I see both docs returned as results.

To Reproduce

  1. Init orama with schema {name: string}
  2. insert docs
[{
    name: "S"
}, 
{
    name: "Scroll"
}]
  1. search for term "scrol", put the typo tolerance to be 2
search({
    term: "scrol",
    tolerance: 2,
})

Expected behavior

Get only one result "Scroll" instead of 2 results

Environment Info

OS: MacOS
Node: 18.19.0
Orama: 2.1.1

Affected areas

Search

Additional context

No response

@naira-petrosyan-m
Copy link
Author

Additionally when I have this doc

{name: "customer.ionic"}

and I do search like this

search({
    term: "customerionic",
    tolerance: 2,
})

I expect to have my doc returned, but it does get returned

allevo added a commit that referenced this issue Oct 16, 2024
@allevo
Copy link
Collaborator

allevo commented Oct 16, 2024

We plan this fix with next release (tomorrow).

Thanks for reporting this issue.

For the second question, Orama uses a tokenizer that split the string into token using space and punctuation. So "customer.ionic" is split into ["customer", "ionic"].

You can customize it, reading the docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants