Skip to content

Fix: respect course_org_filter when expanding organization facets using meilisearch - #277

Merged
bradenmacdonald merged 6 commits into
openedx:masterfrom
eduNEXT:dmh/limit-org-facet-to-permitted-orgs
Jun 26, 2026
Merged

Fix: respect course_org_filter when expanding organization facets using meilisearch#277
bradenmacdonald merged 6 commits into
openedx:masterfrom
eduNEXT:dmh/limit-org-facet-to-permitted-orgs

Conversation

@DeimerM

@DeimerM DeimerM commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Description

During testing with the catalog MFE, I discovered that the organizations filter does not respect the course_org_filter configuration. Currently, all organizations are being returned and populated in the organization filter.

This issue occurs during the facet expansion logic, which removes filters for the target facet to retrieve its full distribution. However, the organization facet's distribution should not be fully expanded, as it must be constrained by the course_org_filter configuration. This ensures the catalog only displays the specific organizations configured for the site. This filtering logic is natively implemented in the default Search Filter Generator: lms_filter_generator.py.

To resolve this, I implemented a mechanism to propagate the course_org_filter initially returned by the Search Filter Generator (if it exists in the field_dictionary). Now, when the logic expands the full distribution for organizations, it correctly filters them based on the valid organizations allowed for the site.

Current and Expected Behavior

  • Current Behavior: The catalog MFE correctly limits the visible courses to those matching the course_org_filter configuration. However, the organization filter sidebar still retrieves and displays the full distribution of all organizations. For example, if the site is configured to only show the demo and other orgs, the openedx org incorrectly still appears in the filter sidebar. (See current screenshot below).
image
  • Expected Behavior: With these changes, the organization filter sidebar is properly constrained, hiding organizations that are not explicitly permitted by the site configuration. (See expected screenshot below).
Screenshot From 2026-06-24 11-56-38

How to Test

  1. Create several organizations and courses belonging to those organizations.
  2. Configure your site to include only a subset of those organizations by setting the course_org_filter in the site configuration.
  3. Navigate to the course catalog and verify that only the permitted organizations appear in the organization filter sidebar.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jun 24, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @DeimerM!

This repository is currently maintained by @Ali-Salman29.

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.

Details
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.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Jun 24, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Needs Tests Run or CLA Signed in Contributions Jun 24, 2026
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jun 24, 2026
@DeimerM

DeimerM commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Hi @Serj-N and @bradenmacdonald, could you please take a look at this PR? It is related to the changes in #213. Thanks!

@bradenmacdonald bradenmacdonald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks for the detailed report and fix.

I tested this and it's working well. Could you please fix the quality issue and add a test?

Please also increase the version in this file if you want us to publish a new release that you can use right away.

@DeimerM

DeimerM commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Makes sense. Thanks for the detailed report and fix.

I tested this and it's working well. Could you please fix the quality issue and add a test?

Please also increase the version in this file if you want us to publish a new release that you can use right away.

Thanks a lot for your comments, @bradenmacdonald. I have fixed the quality tests and added the new test. I also updated the plugin version. Please let me know if you have any additional feedback!

Comment thread search/elastic.py Outdated
@bradenmacdonald
bradenmacdonald merged commit eaf0546 into openedx:master Jun 26, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Tests Run or CLA Signed to Done in Contributions Jun 26, 2026
@openedx-webhooks openedx-webhooks removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants