opensanctions / opensanctions/poliloom

Update Meilisearch delete_documents to use filter instead of deprecated ids parameter

Open Beginner friendly
#150 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

loom
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
  1. Add "id" to filterableAttributes in the index settings (search.py:69) so filter-based deletion works
  2. Switch delete_documents call from positional ids to the filter keyword 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}]")
  1. Rebuild index settings (or run index-create) after deploying the filterableAttributes change
References

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.