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

@@ -63,7 +63,7 @@ class RecipeIngredient(SqlAlchemyBase, BaseMixins):
recipe_id: Mapped[GUID | None] = mapped_column(GUID, ForeignKey("recipes.id"))
title: Mapped[str | None] = mapped_column(String) # Section Header - Shows if Present
note: Mapped[str | None] = mapped_column(String) # Force Show Text - Overrides Concat
note: Mapped[str | None] = mapped_column(String, index=True) # Force Show Text - Overrides Concat
# Scaling Items
unit_id: Mapped[GUID | None] = mapped_column(GUID, ForeignKey("ingredient_units.id"), index=True)
@@ -73,7 +73,7 @@ class RecipeIngredient(SqlAlchemyBase, BaseMixins):
food: Mapped[IngredientFoodModel | None] = orm.relationship(IngredientFoodModel, uselist=False)
quantity: Mapped[float | None] = mapped_column(Float)
original_text: Mapped[str | None] = mapped_column(String)
original_text: Mapped[str | None] = mapped_column(String, index=True)
reference_id: Mapped[GUID | None] = mapped_column(GUID) # Reference Links

View File

@@ -23,7 +23,7 @@ class RecipeInstruction(SqlAlchemyBase):
position: Mapped[int | None] = mapped_column(Integer, index=True)
type: Mapped[str | None] = mapped_column(String, default="")
title: Mapped[str | None] = mapped_column(String)
text: Mapped[str | None] = mapped_column(String)
text: Mapped[str | None] = mapped_column(String, index=True)
ingredient_references: Mapped[list[RecipeIngredientRefLink]] = orm.relationship(
RecipeIngredientRefLink, cascade="all, delete-orphan"

View File

@@ -55,7 +55,7 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
# General Recipe Properties
name: Mapped[str] = mapped_column(sa.String, nullable=False, index=True)
description: Mapped[str | None] = mapped_column(sa.String)
description: Mapped[str | None] = mapped_column(sa.String, index=True)
image: Mapped[str | None] = mapped_column(sa.String)
# Time Related Properties