1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 07:39:41 +02:00

feat: Improved Ingredient Matching (#2535)

* added normalization to foods and units

* changed search to reference new normalized fields

* fix tests

* added parsed food matching to backend

* prevent pagination from ordering when searching

* added extra fuzzy matching to sqlite ing matching

* added tests

* only apply search ordering when order_by is null

* enabled post-search fuzzy matching for postgres

* fixed postgres fuzzy search test

* idk why this is failing

* 🤦

* simplified frontend ing matching
and restored automatic unit creation

* tightened food fuzzy threshold

* change to rapidfuzz

* sped up fuzzy matching with process

* fixed units not matching by abbreviation

* fast return for exact matches

* replace db searching with pure fuzz

* added fuzzy normalization

* tightened unit fuzzy matching thresh

* cleaned up comments/var names

* ran matching logic through the dryer

* oops

* simplified order by application logic
This commit is contained in:
Michael Genson 2023-09-15 12:19:34 -05:00 committed by GitHub
parent 084ad4228b
commit 2dfbe9f08d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 738 additions and 97 deletions

View file

@ -205,8 +205,7 @@ export default defineComponent({
async function createAssignFood() {
foodData.data.name = foodSearch.value;
await foodStore.actions.createOne(foodData.data);
props.value.food = foodStore.foods.value?.find((food) => food.name === foodSearch.value);
props.value.food = await foodStore.actions.createOne(foodData.data) || undefined;
foodData.reset();
}
@ -218,8 +217,7 @@ export default defineComponent({
async function createAssignUnit() {
unitsData.data.name = unitSearch.value;
await unitStore.actions.createOne(unitsData.data);
props.value.unit = unitStore.units.value?.find((unit) => unit.name === unitSearch.value);
props.value.unit = await unitStore.actions.createOne(unitsData.data) || undefined;
unitsData.reset();
}