-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add Typesense backend for search (FC-0091) #225
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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for the pull request, @samuelallan72! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
2323f98 to
afbb4a7
Compare
6ee6966 to
b1c75f2
Compare
b1c75f2 to
1815843
Compare
1815843 to
6bd530b
Compare
Yeah, please don't include unrelated package bumps if they're not needed. You should be able to just run |
bradenmacdonald
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far. Did you look into the possibility of combining the threads and comments into a single index? Both object types have comment_thread_id, course_id, and body, and the other thread-only fields (title, commentable_id, context could either be omitted from the comments or de-normalized and included. I don't know if that's necessarily any better, just wondering your thoughts.
Unfortunately here I couldn't; Running |
|
In such cases, I would personally run |
I did think about that. I'm not sure why it has been kept as two indexes, or why in Meilisearch, the data has been normalised but the indexes kept separate. I kept them separate to be consistent with the other approaches, and I'm not sure if there are any other hidden use cases. I would imagine the most efficient method would be to combine to a single index, and normalise the data too:
Then any search would be a single search operation, rather than two. I might be missing some use cases though, and I'm not sure exactly how |
Sounds good, I've done that for this PR now. :) I also noted in the description that this has been hacked together (ie. not a reproducible |
|
@samuelallan72 My impression is that the only reason they are stored in two separate search indexes is because they're represented by two different Django models, and the original implementation of search was based around some 1:1 mapping of models to indexes. But there's no reason to stick to that necessarily as far as I can see. For the Studio search features, we pull in all kinds of different models (course components, library components, library containers, ...) and normalize them into one index, and it works really well. |
|
@bradenmacdonald that sounds good, I'll update the code to use a single index and we'll see how it goes. My only concern with this approach is that it may be more difficult to objectively compare with the Meilisearch backend, since it will be two indices vs one. |
|
@bradenmacdonald I converted it to use a single index, ready for review. :) |
bradenmacdonald
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this mostly as described, and it's working very well! Didn't find any issues with it, though I had some suggestions for the code.
|
Thanks for your review @bradenmacdonald ! I've addressed your comments, and it's ready for another pass. :) |
bradenmacdonald
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks great, and is working very well as far as I can tell.
- I tested this: similar to the described procedure
- I read through the code
- I checked for accessibility issues: n/a
- Includes documentation: we will add docs if we plan to merge it.
|
🛑 Note: we are not planning to merge this PR for now. We are just using this branch to evaluate Typesense, and would only merge this if a decision is made to support Typesense in future releases of Open edX. |
Also run `make upgrade` to be able to successfully compile dependencies. This upgrade may need to be refactored out of this commit. Private-ref: https://tasks.opencraft.com/browse/BB-9975
Co-authored-by: Braden MacDonald <mail@bradenm.com>
Also finish implementing the validation method, and address lint errors.
in response to review
323c6c3 to
98a92fb
Compare
|
rebased on master and fixed merge conflicts |
🛑 Note from @bradenmacdonald:
Description
Add a Typesense backend for searching.
NOTE:
make compile-requirementsis currently broken on master, so I hacked typesense into the compiled requirements .txt files by:make upgrade && make compile-requirements, then removing all the changes not related to the new typesense dependency. UPDATE: it's fixed on master since #226 ; I can rebase to update requirements here later if we continue work on this (if there are plans to get it merged).Supporting information
Private-ref: https://tasks.opencraft.com/browse/BB-9975
Test instructions
Test searching
Test reindexing
tutor dev exec lms -- python manage.py lms rebuild_forum_indicesto reindex the data.Test initializing
tutor dev exec lms -- python manage.py lms initialize_forum_indices --forceand verify the indices are recreated.tutor dev exec lms -- python manage.py lms rebuild_forum_indicesto reindex the data.Test validating the indices
tutor dev exec lms -- python manage.py lms validate_forum_indices.tutor dev exec lms -- python manage.py lms validate_forum_indicesagain.tutor dev exec lms -- python manage.py lms initialize_forum_indices --force.tutor dev exec lms -- python manage.py lms validate_forum_indicesagain.Rough instructions for setting up a devstack for this:
Deadline
None
Merge checklist:
Check off if complete or not applicable: