Store Collection metadata + component count in meilisearch - #684
Merged
rpenido merged 6 commits intoSep 12, 2024
Conversation
rpenido
reviewed
Sep 11, 2024
rpenido
left a comment
Member
There was a problem hiding this comment.
This is looking good @pomegranited!
Some issues from openedx#35469 will also affect here, though.
Comment on lines
+170
to
+173
| update_library_collection_index_doc.delay( | ||
| str(library_collection.library_key), | ||
| library_collection.collection_key, | ||
| ) |
Member
There was a problem hiding this comment.
We need to make these events sync so the frontend is updated as soon as we make a change in the search index.
Suggested change
| update_library_collection_index_doc.delay( | |
| str(library_collection.library_key), | |
| library_collection.collection_key, | |
| ) | |
| api.upsert_library_collection_index_doc(library_collection.library_key, library_collection.collection_key) |
A bit more context here: openedx#35367 (comment)
to update the index before the frontend re-fetches
rpenido
approved these changes
Sep 12, 2024
rpenido
left a comment
Member
There was a problem hiding this comment.
LGTM @pomegranited 👍
Thank you for your work here!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR makes several enhancements related to how Collections are indexed in the Studio Search app.
LIBRARY_COLLECTION_CREATED/LIBRARY_COLLECTION_UPDATEDevents and adds/updates the collection document in the Studio content search index.block_idfield. This key + the library_key is required for accessing the Collection REST APIs.num_children. Collections store the number of entities in the collection.Future PRs may store XBlock children counts here.
Libraries v2 is not used in production by default yet, so this change shouldn't affect any current users.
Supporting information
Related to openedx/frontend-app-authoring#1260
Based on openedx#35469
Private-ref: FAL-3787
Testing instructions
Set up tutor:
tutor dev run cms python manage.py migratetutor dev run cms ./manage.py cms reindex_studio --experimentalto add the new fields.In the content-authoring MFE:
lib:SampleTaxonomyOrg1:AL1Hint: you can retrieve the block keys using the REST API, e.g. http://studio.local.edly.io:8001/api/libraries/v2/lib:SampleTaxonomyOrg1:AL1/blocks/
In the shell
tutor dev run cms python manage.py cms shell, add blocks to the collection:In meilisearch http://meilisearch.local.edly.io:7700:
tutor config printvalue MEILISEARCH_API_KEYid = collection.id(unique)block_id = collection.keynum_children = <number of blocks in the collection>Deadline
Before Sumac gets cut in October.