feat: server side search (#2112) (#2117)

* feat: server side search API (#2112)

* refactor repository_recipes filter building

* add food filter to recipe repository page_all

* fix query type annotations

* working search

* add tests and make sure title matches are ordered correctly

* remove instruction matching again

* fix formatting and small issues

* fix another linting error

* make search test no rely on actual words

* fix failing postgres compiled query

* revise incorrectly ordered migration

* automatically extract latest migration version

* test migration orderes

* run type generators

* new search function

* wip: new search page

* sortable field options

* fix virtual scroll issue

* fix search casing bug

* finalize search filters/sorts

* remove old composable

* fix type errors

---------

Co-authored-by: Sören <fleshgolem@gmx.net>
This commit is contained in:
Hayden
2023-02-11 21:26:10 -09:00
committed by GitHub
parent fc105dcebc
commit 71f8c1066a
36 changed files with 1057 additions and 822 deletions

View File

@@ -3,7 +3,7 @@ from typing import Any, Generic, TypeVar
from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit
from humps import camelize
from pydantic import BaseModel
from pydantic import UUID4, BaseModel
from pydantic.generics import GenericModel
from mealie.schema._mealie import MealieModel
@@ -16,6 +16,15 @@ class OrderDirection(str, enum.Enum):
desc = "desc"
class RecipeSearchQuery(MealieModel):
cookbook: UUID4 | str | None
require_all_categories: bool = False
require_all_tags: bool = False
require_all_tools: bool = False
require_all_foods: bool = False
search: str | None
class PaginationQuery(MealieModel):
page: int = 1
per_page: int = 50