From e58e764b6bb0310c98b1673ccb6d37d038345c9a Mon Sep 17 00:00:00 2001 From: Roland Date: Fri, 31 May 2024 23:52:27 -0600 Subject: [PATCH] Matching against description for App search. --- app/src/components/Search.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/components/Search.js b/app/src/components/Search.js index d63346eb..c31d477a 100644 --- a/app/src/components/Search.js +++ b/app/src/components/Search.js @@ -33,6 +33,16 @@ const SUGGESTED_APPS = [ {location: '/videos/channel', title: 'Channels', description: 'View the Channels of your Videos'}, {location: '/zim', title: 'Zim', description: 'View your Zims'}, {location: '/zim/manage', title: 'Manage Zim', description: 'Manage your Zims'}, + { + location: '/more/calculators?calc=temperature', + title: 'Temperature Calculator', + description: 'Convert Celsius, Fahrenheit, Kelvin' + }, + { + location: '/more/calculators?calc=electrical', + title: 'Electrical Calculator', + description: 'Convert Volts, Ohms, Amps, Watts' + }, ]; export const useSearch = (defaultLimit = 48, totalPages = 0, emptySearch = false, model) => { @@ -250,7 +260,9 @@ export function useSearchSuggestions(defaultSearchStr, defaultTagNames) { const matchingApps = SUGGESTED_APPS.filter(i => i.title.toLowerCase().includes(lowerSearchStr) - || fuzzyMatch(i.title.toLowerCase(), lowerSearchStr)); + || fuzzyMatch(i.title.toLowerCase(), lowerSearchStr) + || i.description.toLowerCase().includes(lowerSearchStr) + || fuzzyMatch(i.description.toLowerCase(), lowerSearchStr)); if (matchingApps && matchingApps.length > 0) { // Match at most 5 apps. results.apps = {name: 'Apps', results: matchingApps.slice(0, 5)};