Skip to content

Commit

Permalink
feat: migrate to Meilisearch
Browse files Browse the repository at this point in the history
We make use of a new search engine to search annotations. The index will
automatically be created and filled during init. This is considered a
breaking change if you have customised your notes index.
  • Loading branch information
regisb authored and DawoudSheraz committed Nov 1, 2024
1 parent fb0477a commit 5be8e62
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/20241017_233457_regis_meilisearch.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- [Bugfix] Actually mount edx-notes-api repositories from host on `tutor mounts add /path/to/edx-notes-api`. (by @regisb)
- 💥[Feature] Replace Elasticsearch by Meilisearch. The implementation is much more compact and readable. All content will be automatically re-indexed during init. (by @regisb)
11 changes: 6 additions & 5 deletions tutornotes/templates/notes/apps/settings/tutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
CLIENT_ID = "notes"
CLIENT_SECRET = "{{ NOTES_OAUTH2_SECRET }}"

ELASTICSEARCH_DSL = {
'default': {
'hosts': '{{ ELASTICSEARCH_SCHEME }}://{{ ELASTICSEARCH_HOST }}:{{ ELASTICSEARCH_PORT }}'
}
}
# Meilisearch credentials
ES_DISABLED = True
MEILISEARCH_ENABLED = True
MEILISEARCH_URL = "{{ MEILISEARCH_URL }}"
MEILISEARCH_API_KEY = "{{ MEILISEARCH_API_KEY }}"
MEILISEARCH_INDEX = "{{ MEILISEARCH_INDEX_PREFIX }}student_notes"

LOGGING = {
"version": 1,
Expand Down
6 changes: 6 additions & 0 deletions tutornotes/templates/notes/build/notes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ USER ${APP_USER_ID}
RUN git clone {{ NOTES_REPOSITORY }} --branch {{ NOTES_REPOSITORY_VERSION }} --depth 1 /app/edx-notes-api
WORKDIR /app/edx-notes-api

# TODO remove after PR is merged
# https://github.com/openedx/edx-notes-api/pull/444
RUN git remote add regisb https://github.com/regisb/edx-notes-api \
&& git fetch regisb regisb/meilisearch \
&& git merge regisb/regisb/meilisearch

###### Install python venv ######
RUN python -m venv /app/venv
ENV PATH=/app/venv/bin:${PATH}
Expand Down
4 changes: 3 additions & 1 deletion tutornotes/templates/notes/tasks/notes/init
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
./manage.py migrate
./manage.py search_index --rebuild -f

# Re-index with meilisearch
./manage.py shell -c "from notesapi.v1.views.meilisearch import reindex; reindex()"

0 comments on commit 5be8e62

Please sign in to comment.