Skip to content

feat: implement the Meilisearch adapter [FC-0144] - #33

Draft
rpenido wants to merge 32 commits into
openedx:mainfrom
open-craft:rpenido/FAL-4411/meilisearch-adapter
Draft

rpenido wants to merge 32 commits into
openedx:mainfrom
open-craft:rpenido/FAL-4411/meilisearch-adapter

Conversation

@rpenido

@rpenido rpenido commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Stacked PR: built on top of #40, which is built on top of #35, #34 and #32. Review only this branch's changes in the diff against rpenido/FAL-4413/rebuild-lifecycle.

Description

Implements the Meilisearch adapter on top of the rebuild contract in #40, the search API in #34, the write API in #32 and the credential API in #35, as part of #14. The branch is stacked on rpenido/FAL-4413/rebuild-lifecycle; until #32, #34, #35 and #40 merge, the compare view also lists their commits, and only 03ccd21, 982c196, df599a5, 5a4b037, 1108dd3, ea46a4f and 5e0397b belong to this PR.

The adapter is registered from AppConfig.ready() and implements search against the live index, including the page check against pagination.maxTotalHits. Its task checks preserve the receipt's unit and include it in WriteFailed, so a rebuild failure names the Meilisearch batch. It renders the index settings from the declared schema: searchableAttributes follows Searchable.order (unordered fields last, in declaration order), filterableAttributes always includes id so id filters behave as they do on Typesense, and rankingRules puts sort first so an explicit sort outranks relevance. reconcile creates the index, rejects an existing index whose primary key is not id, and patches only the settings that drifted.

The rebuild primitives remove targets with the same index and version prefix, swap the target into the live logical name, and discard the target on abort. The live index keeps the logical name, so the swap never needs a rename. check_writes checks the pending tasks in one request with GET /tasks?uids=, preserving order, and commit_rebuild waits for the target's enqueued and processing tasks before the swap.

upsert and delete submit one bounded batch to the live index or to a rebuild target and return the Meilisearch task id; check_write performs one poll and raises WriteFailed when the task failed or was canceled, and a failed or unknown task in a batch does the same. Datetimes are written as POSIX seconds, and the abstract filter expression renders as ANDed groups of ORed terms.

The transport is a small urllib client instead of a new dependency, because the Open edX platform pins its own requirements. It follows no redirects, bounds the response size, and never puts a credential or a response body into an exception.

mint_credential signs a tenant token for the live index with HMAC-SHA256: it reads the parent key's UID from /keys, embeds the scope's filters as searchRules, and expires after the requested lifetime. Following ADR 0002, the parent is search_api_key when set, otherwise api_key; the master key is not listed and cannot sign. A known-answer test pins the token to the official client's output.

Testing instructions

  • The adapter is library code with no manual flow. Run uv run --group test pytest -q for the suite, and uv run tox -e quality for the linters.
  • To inspect the settings rendered for the Studio course schema, call MeilisearchAdapter(registration, backend).settings().

Additional Information

Related to:

Depends on:

Used by:


Private ref: FAL-4411

@openedx-webhooks

openedx-webhooks commented Nov 24, 2026 •

Copy link
Copy Markdown

Thanks for the pull request, @rpenido!

This repository is currently maintained by @ormsbee.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 24, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Nov 24, 2026
@rpenido rpenido changed the title feat: implement the Meilisearch adapter feat: implement the Meilisearch adapter [FC-0144] Nov 24, 2026
@rpenido
rpenido marked this pull request as draft November 24, 2026 18:03
@rpenido
rpenido force-pushed the rpenido/FAL-4411/meilisearch-adapter branch from 6f26b57 to 3e1ecdd Compare November 24, 2026 18:16
@rpenido
rpenido force-pushed the rpenido/FAL-4411/meilisearch-adapter branch from 3e1ecdd to c05457a Compare November 24, 2026 18:27
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Nov 24, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Nov 24, 2026
@rpenido
rpenido force-pushed the rpenido/FAL-4411/meilisearch-adapter branch from c05457a to aa7cf78 Compare November 25, 2026 14:06
@rpenido
rpenido force-pushed the rpenido/FAL-4411/meilisearch-adapter branch from aa7cf78 to d891875 Compare November 25, 2026 17:05
navinkarkera and others added 7 commits December 3, 2026 09:09
SearchQuery carries the text, one bounded page and the same exact filter expression delete() accepts, including id equality and IN lists. api.search() resolves the registration and delegates to Adapter.search(), which the Meilisearch adapter implements against the live index with q, offset, limit and the rendered filter. count_only sends limit 0 so the migrator can count without transferring a page; the estimated total is never reported as exact.
The shared hit count validation it also carried belongs to the
Meilisearch adapter branch.
@rpenido
rpenido force-pushed the rpenido/FAL-4411/meilisearch-adapter branch 2 times, most recently from bea9d6c to 9e66735 Compare December 3, 2026 22:55
rpenido and others added 8 commits December 3, 2026 19:57
Render the query text, one page and the filters for the live index, and
reject a page window beyond pagination.maxTotalHits instead of returning a
short page.

Co-authored-by: Navin Karkera <navin@opencraft.com>
Preserve the receipt's unit through the task checks and include it in
WriteFailed, so a rebuild failure names the consumer batch.
@rpenido
rpenido force-pushed the rpenido/FAL-4411/meilisearch-adapter branch from 9e66735 to 5e0397b Compare December 3, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

4 participants