The sorting of search results randomly changes order after running the update function
hawkup opened this issue · comments
Describe the bug
When using a custom document ID and after running the update function, the ordering of search results randomly changes.
Here's a screen recording comparing the behavior between using a custom document ID and an auto-generated document ID.
CleanShot.2567-02-13.at.14.15.51.mp4
To Reproduce
Link to code example: https://codesandbox.io/p/sandbox/zealous-lederberg-mc48tf?file=%2Fsrc%2FApp.tsx%3A30%2C52
- Create a schema with a custom document ID.
- Insert data with a custom document ID.
- Search with sorting (using another field, in my case, I use createdAt for sorting). The results from the search are ordered correctly.
- Run the update function to update one entity.
- Search with the same parameters again. The ordering of the results has changed.
Expected behavior
When using a custom document ID and after running the update function, the ordering of search results should not change.
Environment Info
OS: macOS Ventura 13.4.1
node: 18.19.0
orama: 2.0.5
Affected areas
Search
Additional context
No response
@allevo could you take a look when you have a moment?
Thanks for the report!
I reproduced the issue in a test and sent a PR to fix it!