openedx / modular-learning

3 stars 1 forks source link

[Course Search] Update search index when course content is changed #196

Closed bradenmacdonald closed 5 months ago

bradenmacdonald commented 7 months ago

"As a course author, I always want search results to be up to date"

Building on #195.

Requirements:

  1. When a new component/section/etc. is created, it should be added to the search index automatically.
  2. When a component (in a course) is edited in Studio, its entry in the search index should be updated automatically.
  3. When a course, section, subsection, unit, or parent block (e.g. library content block, split test block) is renamed, its entry in the search index should be updated automatically, and the location/breadcrumbs field of all child blocks should be updated automatically.
  4. When something (component/subsection/etc) is moved to another place in the course, all relevant breadcrumbs should be updated.
  5. If the "reindex all courses/libraries" command is currently running, make sure it doesn't undo these changes. (The changes should either (A) be applied to the new index [perhaps in addition to the old/current index] or (B) be queued until after the reindex is complete.)
  6. Publishing content has no effect; this entire index and story refers only to 'draft' content (what authors see in Studio).

Ideally:

  1. These things will happen asynchronously.
  2. If the search engine (e.g. Meilisearch) is offline/down at the moment the change is made, the update will be queued; once the search engine is back online, the index will be updated. (Note there are at least two ways to do this: one is by maintaining a queue of updates and writing them to the index when you can; the other is maintaining a list of "blocks that need updating" and regularly queuing a task to work through the list)
  3. The same code can be used to keep (v2) library blocks up to date in the index (only do it as part of this PR if easy and quick).