Skip to content

Commit

Permalink
feat: meilisearch backend for notes search
Browse files Browse the repository at this point in the history
This is a very simple and basic backend. It is based on Django signals,
just like the Elasticsearch backend. But it is much simpler, in the
sense that there are just two signals: one for saving documents and one
for deletion.

This backend is limited, in the sense that it does not support
highlighting -- but that's probably not such a big deal.

To start using this backend, define the following settings:

	ES_DISABLED = True
	MEILISEARCH_ENABLED = True
	MEILISEARCH_URL = "http://meilisearch:7700"
	MEILISEARCH_API_KEY = "s3cr3t"
	MEILISEARCH_INDEX = "tutor_student_notes"
  • Loading branch information
regisb committed Nov 12, 2024
1 parent 3e30f2a commit 8030d34
Show file tree
Hide file tree
Showing 8 changed files with 392 additions and 124 deletions.
7 changes: 6 additions & 1 deletion notesapi/v1/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@

from .exceptions import SearchViewRuntimeError


# pylint: disable=import-outside-toplevel
def get_views_module():
"""
Import views from either mysql or elasticsearch backend
"""
if settings.ES_DISABLED:
from . import common as backend_module
if getattr(settings, "MEILISEARCH_ENABLED", False):
from . import meilisearch as backend_module
else:
from . import common as backend_module
else:
from . import elasticsearch as backend_module
return backend_module
Loading

0 comments on commit 8030d34

Please sign in to comment.