From 0acc26044707f3ac4553fc0dd4e6339146ef4424 Mon Sep 17 00:00:00 2001 From: RealFoxie <52831920+RealFoxie@users.noreply.github.com> Date: Sun, 29 Jan 2023 02:07:49 +0100 Subject: [PATCH] Improve the default search by focussing on title and description (#2053) * ignore field norm + weights for basic search * better search config for advanced search * undo (wrong) automatic formatting --- frontend/composables/recipes/use-recipe-search.ts | 3 ++- frontend/pages/search.vue | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/composables/recipes/use-recipe-search.ts b/frontend/composables/recipes/use-recipe-search.ts index ad3aaa65d..19d003bfd 100644 --- a/frontend/composables/recipes/use-recipe-search.ts +++ b/frontend/composables/recipes/use-recipe-search.ts @@ -13,7 +13,8 @@ export const useRecipeSearch = (recipes: Ref) => { findAllMatches: true, maxPatternLength: 32, minMatchCharLength: 2, - keys: ["name", "description", "recipeIngredient.note", "recipeIngredient.food.name"], + ignoreFieldNorm: true, + keys: [{ name: "name", weight: 1.3 }, { name: "description", weight: 1.2 }, "recipeIngredient.note", "recipeIngredient.food.name"], }, }); diff --git a/frontend/pages/search.vue b/frontend/pages/search.vue index 3fe9bdb69..30f39b75b 100644 --- a/frontend/pages/search.vue +++ b/frontend/pages/search.vue @@ -186,7 +186,8 @@ export default defineComponent({ findAllMatches: true, maxPatternLength: 32, minMatchCharLength: 2, - keys: ["name", "description", "recipeIngredient.note", "recipeIngredient.food.name"], + ignoreFieldNorm: true, + keys: [{ name: "name", weight: 1.3 }, { name: "description", weight: 1.2 }, "recipeIngredient.note", "recipeIngredient.food.name"], }, });