Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: searching tag refinement was sometimes not working #34933

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

bradenmacdonald
Copy link
Contributor

@bradenmacdonald bradenmacdonald commented Jun 6, 2024

Description

Fixes openedx/modular-learning#224

It turns out that if no documents on the instance contain any "level 3" tags, then the search which tries to filter the tags using a keyword search (and explicitly includes the tags.level3 field) would fail. The fix is simple, to always explicitly add tags.levelX as "searchable fields", rather than assuming they'll be implicitly searchable because the parent tags field is included.

Supporting information

Testing instructions

To reproduce the bug, before checking out this branch, go to this line:

and change 4 to 3. This simulates "no documents have level 3 tags". Then run python manage.py cms reindex_studio --experimental.

Then open the search UI in course authoring and enter a keyword into the tags filter. It should have no effect.

Then checkout this branch, run the reindex command again, and see that the fix worked.

Deadline

We want to get this backported to Redwood ASAP.

Private Ref: MNG-4283

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jun 6, 2024
@openedx-webhooks
Copy link

Thanks for the pull request, @bradenmacdonald! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

Copy link
Contributor

@rpenido rpenido left a comment

Choose a reason for hiding this comment

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

LGTM @bradenmacdonald! 👍

  • I tested this following the testing instructions
  • I read through the code and considered the security, stability and performance implications of the changes.
  • I tested that the UI can be used with a keyboard only (tab order, keyboard controls).
  • Includes tests for bugfixes and/or features added.

Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

👍 This fixes the issue described perfectly, and I've raised another potential issue, see inline comment.

  • I tested this on my tutor dev stack using the PR instructions
  • I read through the code.
  • I checked for accessibility issues N/A
  • Includes code docs to explain the change.
  • User-facing strings are extracted for translation N/A

Fields.tags + "." + Fields.tags_level0,
Fields.tags + "." + Fields.tags_level1,
Fields.tags + "." + Fields.tags_level2,
Fields.tags + "." + Fields.tags_level3,
Copy link
Contributor

@pomegranited pomegranited Jun 6, 2024

Choose a reason for hiding this comment

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

Hmm.. I thought we only supported a 3-level tag hierarchy, but this PR uses 4 levels, and I can see 4 levels in ESDC..

Do we need to update openedx-learning too?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I've been a bit inconsistent about that. We only officially support 3 levels, though at the core the code will support a higher number of levels - it's just that some search and listing features only work on three (or in this case 4) levels. It would be a good change in the future to drop this fourth level from the search engine and to prevent the import or creation of taxonomies with 4 levels (or support 4 levels). For now I don't think it's a bug we need to fix though.

@pomegranited pomegranited merged commit e1e3c87 into openedx:master Jun 7, 2024
46 checks passed
@pomegranited pomegranited deleted the error-missing-level3-tags branch June 7, 2024 00:00
@openedx-webhooks
Copy link

@bradenmacdonald 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

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
Archived in project
Development

Successfully merging this pull request may close these issues.

[Tagging] Sometimes the tags filter is not searchable
5 participants