TL;DR what is the best way to implement search functionality in FQL?
I’ve been building a site that has a search functionality. It lets you search for emojis, and categories of emojis. So the category “horror” might contain these emojis , and the user can find that category by searching “horror”, “spooky”, “scary” etc. The search bar is live, so if you type a partial string match like “spoo” that would work too.
I’m looking for the simplest solution to achieve something like this. I actually had a working version of it, using the undocumented Ngram function for FQL, but something has changed and that no longer works.
A search like this seems like something that should be simple to implement. After all it’s very common for a site to have a search function, and searching for partial strings is something users have got used to. e.g. every time you search in an address bar.
What I’ve tried so far…
This all worked fine until recently. I lifted some code from the Fwitter Tutorial and altered it so that multiple keywords could be searched for each of the categories. I used the Ngram approach and used this code to create an index:
const createEmojiSetNgramIndex = CreateIndex({
name: 'emojiset_by_exact_ngrams_full',
source: [
{
collection: [Collection('EmojiSet')],
fields: {
wordparts: Query(Lambda('match', Map(Select(['data', 'queries'], Var('match')), Lambda('query', GenerateNgrams('query', Var('match'))))))
}
}
],
terms: [
{
binding: 'wordparts'
}
]
})
That worked fine for a while. But since then the code no longer works. I haven’t made any changes to the code. I’ve tried to build an identical index, the index builds but returns no results.
Any prod in the right direction would be really appreciated. Thanks.