mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 07:56:18 -05:00
Matching against description for App search.
This commit is contained in:
parent
2dae32fbcc
commit
e58e764b6b
1 changed files with 13 additions and 1 deletions
|
|
@ -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)};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue