mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 15:49:42 +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:
parent
084ad4228b
commit
2dfbe9f08d
17 changed files with 738 additions and 97 deletions
|
@ -13,9 +13,9 @@ interface PublicStoreActions<T extends BoundT> {
|
|||
}
|
||||
|
||||
interface StoreActions<T extends BoundT> extends PublicStoreActions<T> {
|
||||
createOne(createData: T): Promise<void>;
|
||||
updateOne(updateData: T): Promise<void>;
|
||||
deleteOne(id: string | number): Promise<void>;
|
||||
createOne(createData: T): Promise<T | null>;
|
||||
updateOne(updateData: T): Promise<T | null>;
|
||||
deleteOne(id: string | number): Promise<T | null>;
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,31 +121,34 @@ export function useStoreActions<T extends BoundT>(
|
|||
if (data && allRef?.value) {
|
||||
allRef.value.push(data);
|
||||
} else {
|
||||
refresh();
|
||||
await refresh();
|
||||
}
|
||||
loading.value = false;
|
||||
return data;
|
||||
}
|
||||
|
||||
async function updateOne(updateData: T) {
|
||||
if (!updateData.id) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
const { data } = await api.updateOne(updateData.id, updateData);
|
||||
if (data && allRef?.value) {
|
||||
refresh();
|
||||
await refresh();
|
||||
}
|
||||
loading.value = false;
|
||||
return data;
|
||||
}
|
||||
|
||||
async function deleteOne(id: string | number) {
|
||||
loading.value = true;
|
||||
const { response } = await api.deleteOne(id);
|
||||
if (response && allRef?.value) {
|
||||
refresh();
|
||||
await refresh();
|
||||
}
|
||||
loading.value = false;
|
||||
return response?.data || null;
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue