From 7d088cdd0be76399936f93f2ed6ee31b5af6dca6 Mon Sep 17 00:00:00 2001 From: keyan Date: Thu, 3 Feb 2022 16:29:48 -0600 Subject: [PATCH] refine search --- api/resolvers/item.js | 5 +++-- components/item.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/resolvers/item.js b/api/resolvers/item.js index fe4bf447..6352ca10 100644 --- a/api/resolvers/item.js +++ b/api/resolvers/item.js @@ -286,7 +286,7 @@ export default { type: 'most_fields', fields: ['title^20', 'text'], minimum_should_match: '100%', - boost: 40 + boost: 400 } }, { @@ -298,7 +298,7 @@ export default { fuzziness: 'AUTO', prefix_length: 3, minimum_should_match: '100%', - boost: 2 + boost: 20 } }, { @@ -308,6 +308,7 @@ export default { type: 'most_fields', fields: ['title^20', 'text'], fuzziness: 'AUTO', + prefix_length: 3, minimum_should_match: '60%' } } diff --git a/components/item.js b/components/item.js index 566d9224..d24e3abc 100644 --- a/components/item.js +++ b/components/item.js @@ -9,7 +9,7 @@ import Pin from '../svgs/pushpin-fill.svg' import reactStringReplace from 'react-string-replace' function SearchTitle ({ title }) { - return reactStringReplace(title, /:high\[(.+)\]/g, (match, i) => { + return reactStringReplace(title, /:high\[([^\]]+)\]/g, (match, i) => { return {match} }) }