opensanctions / opensanctions/poliloom
Update Meilisearch delete_documents to use filter instead of deprecated ids parameter
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 22
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
The meilisearch Python SDK has deprecated the positional ids parameter in Index.delete_documents(). Our code in poliloom/search.py:160 passes document IDs positionally, triggering a DeprecationWarning on every call:
DeprecationWarning: The use of ids is depreciated and will be removed in the future
What needs to change
- Add
"id"tofilterableAttributesin the index settings (search.py:69) so filter-based deletion works - Switch
delete_documentscall from positionalidsto thefilterkeyword argument:
# Current (deprecated)
index.delete_documents(batch)
# Replacement
id_list = ", ".join(f'"{doc_id}"' for doc_id in batch)
index.delete_documents(filter=f"id IN [{id_list}]")
- Rebuild index settings (or run
index-create) after deploying the filterableAttributes change
References
- PR #756: Add ability to delete documents by filter — introduced the
filterparameter and deprecatedids - Meilisearch v1.2.0 release — server-side support for
POST /indexes/{uid}/documents/deletewith filter
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in poliloom/search.py at lines 69 and 160: inspect the index settings and the delete_documents call. Update filterableAttributes and use the filter-based deletion described in the issue, then rebuild the index settings or run index-create. Done means deletions no longer use the deprecated ids parameter and the warning is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, search
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100