Add meilisearch

This commit is contained in:
2022-02-08 21:11:54 +03:00
parent c759e0edc0
commit df7db6a01f
11 changed files with 204 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
from app.models import Author
from app.services.common import TRGMSearchService, GetRandomService
from app.services.common import TRGMSearchService, MeiliSearchService, GetRandomService
GET_OBJECT_IDS_QUERY = """
@@ -66,3 +66,12 @@ ORDER BY RANDOM() LIMIT 1;
class GetRandomAuthorService(GetRandomService):
MODEL_CLASS = Author
GET_RANDOM_OBJECT_ID_QUERY = GET_RANDOM_OBJECT_ID_QUERY
class AuthorMeiliSearchService(MeiliSearchService):
MODEL_CLASS = Author
SELECT_RELATED = ["source"]
PREFETCH_RELATED = ["annotations"]
MS_INDEX_NAME = "authors"
MS_INDEX_LANG_KEY = "author_langs"