meilisearch: Filtered search does not take recently updated document into account
Describe the bug When I update a document already in the index, a subsequent search with a filtering will not return the just-updated document. Fetch the document itself from the documents-endpoint returns the document. I also get the document from the search when I do not use any filters.
When I re-index all documents the issue is fixed. But this is not a desired workaround.
Note The filter in question does not filter out the aforementioned document. New documents are not affected by this issue.
To Reproduce Steps to reproduce the behavior:
- Update document
- Search with filter (which will return said document)
- Document is not returned by search
Expected behavior The updated document is returned from search with or without any filter.
Meilisearch version:
1.2.0 (getmeili/meilisearch:v1.2.0
)
Additional context
- ~7500 documents in the index
- no pending tasks
- Docker 24.0.2
- PHP 8.2.7
- meilisearch/meilisearch-php (1.2.1)
- meilisearch/search-bundle (0.13.0)
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (7 by maintainers)
Ok, so I understand now. Note that the original order of the documents is non-determined.
If what you want is a stable determined order, I advise you to first sort on the title and just after that on the id maybe 🤔 If this solution doesn’t please you, could you please, create a new discussion on the product repository, explaining your specific use case?
Hi @daFish, thanks for that information, they seem pretty quick so likely not an issue.
I think perhaps the issue you are seeing is to do with caching of requests on the front end. Please let me know if this doesn’t match what you’re seeing, but it sounds like it might be.
So for example in the mini-dashboard I search in my movies documents for ‘batman’. In the fetch requests you’ll see a request for every letter I type (6 sent to /search in total)
As I do that I get a batman document back in my results as expected. Great.
If I then, in the background, do an update to that document and, without refreshing my search page, type the same letters again ‘batman’ you’ll see there are no further fetch requests made. That’s because there’s a level of caching on the front end (the exact same request to /search is made so it’s not sent again). As there are no new requests you’re still seeing the outdated document.
However if I update that search query by anything else other than exactly ‘batman’ again e.g. I add a space or additional words then I would see my updated document appear. Equally, if I refresh the search page (without any indexing changes) and do the exact search again I’ll also get the updated document.
It also makes sense then that if you send a specific fetch request again manually you see the updated document.
Does that sound like what’s happening for you?