Is it possible to specify a localized (e.g. Spanish or German or any other language) input json and get search results with localized data?
A few options which would work right now:
(a) have distinct lists as input (one for each locale), or
(b) use logical query operators to search the appropriate locale.
For (b):
const list = [
{
i18n: {
greeting: 'Hello World'
},
lang: 'en-US'
},
{
i18n: {
greeting: 'Hola Mundo'
},
lang: 'es'
}
]
const fuse = new Fuse(list, {
useExtendedSearch: true,
keys: ['i18n.greeting', 'lang']
})
// Search for item where language is English *and* `greeting` is like "helo wold"
fuse.search({
lang: "'en-US", // search exact string
'i18.greeting': 'helo wold'
})
Most helpful comment
A few options which would work right now:
(a) have distinct lists as input (one for each locale), or
(b) use logical query operators to search the appropriate locale.
For (b):