-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
[BUG] Duplicate hits when overriding id
#100
Comments
Thank you @aaronhuggins , |
@micheleriva In this case it would be necessary to decide whether to override the id that the engine inserts or keep them both and understand how to manage them. Am I right? Do you have something in mind? |
Personally, I would discourage allowing users to define their own IDs. I think that trying to override the |
Yes totally, it is prone to errors as Lyra relies on the id internally. If you agree, I can take charge of this. |
@stearm pushing a commit right now 😄 |
@aaronhuggins to be released in v0.0.6 |
I did the same search but using const searchResult = search(db, {
term: 'if',
properties: ['quote']
}); Output: {
elapsed: 136800n,
hits: [
{
id: '2.0',
quote: 'If you really look closely, most overnight successes took a long time.',
author: 'Steve Jobs',
what: '',
who: ''
},
{
id: '3.0',
quote: 'If you are not willing to risk the usual, you will have to settle for the ordinary.',
author: 'Jim Rohn',
what: '',
who: ''
}
],
count: 2
} |
Describe the bug
When overriding the property
id
of documents, search will return more hits than the actual count of hits in the search results. The additional hits will be duplicated documents.To Reproduce
Steps to reproduce the behavior:
Use this sample script:
Sample output:
Expected behavior
It is expected that the
hits
array contains no more thancount: n
and no duplicated documents.Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
@nearform/lyra
0.0.4, 0.0.5Smartphone (please complete the following information):
N/A
Additional context
Bug is reproducible under Node 16, 17, and 18, and Deno 1.24.x (using import of
https://cdn.skypack.dev/@nearform/lyra@v0.0.5?dts
)The text was updated successfully, but these errors were encountered: