Skip to content

Conversation

@jawad-khan
Copy link
Member

Description

This PR is for issue 36868.
Features:

  • It will force incremental behavior for rebuild_studio.
  • Melisearch app to keep track of schema creation.
  • Made rebuild_studio to asynchronous.

Testing instructions

Enable MEILISEARCH_ENABLED locally.
Add openedx.core.djangoapps.meilisearch in installed apps.

api.rebuild_index(self.stdout.write, incremental=True)
else:
api.rebuild_index(self.stdout.write)
api.rebuild_index.delay()
Copy link
Contributor

Choose a reason for hiding this comment

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

How will the administrator know when it's done?

)
def test_reindex_meilisearch_collection_error(self, mock_meilisearch) -> None:

mock_logger = Mock()
Copy link
Contributor

Choose a reason for hiding this comment

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

You can delete this mock and the related assertion below if we're not using it anymore. Same in the next test.

# Changing them on a populated index will "re-index all documents in the index", which can take some time
# and use more RAM. Instead, we configure an empty index then populate it one course/library at a time.
if not incremental:
_configure_index(index_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

We still need to call _configure_index I think. We need something like this:

if not _is_index_configured(STUDIO_INDEX_NAME):
    if should_reset:  # Was --reset passed? Delete the whole index and start over
        reset_index()
    elif (# of documents in index < 2_000) or in_place:  # Did user specify --in-place?
        _configure_index()  # Change the index in place. May be slow if it's populated with lots of data!
    else:
        raise Error("The index needs to be migrated to the newer format. Pass --reset to delete all index data and rebuild the index from scratch, or --in-place to update the index configuration in place (may take a long time and slow down search results in the meantime).")

Although if we test this with a large dataset and find that the "in place" is always faster than rebuilding the whole index, we should just do that automatically, and this can be significantly simplified.

# and use more RAM. Instead, we configure an empty index then populate it one course/library at a time.
if not incremental:
_configure_index(index_name)
with nullcontext(STUDIO_INDEX_NAME) as index_name:
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just remove this whole line/context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants