-
-
Notifications
You must be signed in to change notification settings - Fork 327
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
No hits with search threshold 0 on documents containing words with common root #911
Comments
@micheleriva here are the unit tests to add to t.test('should return results for words with same root if threshold is 0', async t => {
// related issue: https://github.com/oramasearch/orama/issues/911
const db = create({
schema: {
title: 'string'
}
})
await insert(db, { title: 'Phone, phonogram' })
await insert(db, { title: 'Bet, better' })
await insert(db, { title: 'Some random sentence' })
const testCases: [string, number][] = [
['p', 1],
['ph', 1],
['pho', 1],
['phone', 1],
['phono', 1],
['b', 1],
['be', 1],
['bet', 1],
['bett', 1],
['bet hi', 0], // the term "hi" is not in any document, there should be no hits with threshold 0
['s', 1],
['r', 1],
['se', 1],
['so', 1]
]
t.plan(testCases.length)
for (const [term, expectedCount] of testCases) {
const result = await search(db, { term, threshold: 0 })
t.same(
result.count,
expectedCount,
`Search term "${term}" with threshold 0 should match ${expectedCount} record(s), but matched ${result.count}`
)
}
}) |
I'll just add that as far as I can tell, this is a regression from Orama v2. @micheleriva Is there any way you could confirm this is a bug and not a usage/comprehension issue on my end? I have to solve this for a project, which will require either going back to v2 or dropping Orama altogether. I don't think I have the time or sufficient understanding of the internals to work on a PR myself at the moment. Let me know if any additional info would be helpful here. Thanks! |
@fturmel I can confirm this as well. Thanks for the suggestion! Backporting to 2.0.24 makes this work but that has issues too. I have a feeling this error might be due to some mismatch between I am using Orama for a large Food Dataset and 3.x is basically unusable for me regarding the same issue that @fturmel mentioned, @micheleriva I think its imperative to add what he's mentioned to the unit test. I'll also try to contrubute more. Since I have a proprietary database right out of a PhD lab, I'll need to do processing on the data / paperwork to present a small test case here. |
Looking at this. Thanks for noticing the issue |
Describe the bug
When doing full text search with threshold 0 on a document that contains a few words with common roots, we don't get a hit until we've typed enough characters to disambiguate them.
To Reproduce
Search with threshold 0 the following test cases:
On the indexed value "Phone, phonogram":
On the indexed value "Bet, better":
On the indexed value "Some random sentence"
Expected behavior
see previous reproduction description
Environment Info
Affected areas
Search
Additional context
No response
The text was updated successfully, but these errors were encountered: