A
A
Andrey Korablin2016-02-15 13:26:04
JavaScript
Andrey Korablin, 2016-02-15 13:26:04

How to search by category?

The application is written in ruby ​​on rails, for the search, the order category is used by the searchkick gem in conjunction with elasticsearch.
It is required to expand the search capabilities as follows - for each category a file is created with synonyms, similar words, category name in different tenses and cases.
The searchkick - synonym feature is not used because it doesn't work with autocomplete ( stackoverflow.com/questions/23321442/autocomplete-... - answer from gem creator).

Tell me in which direction to dig, that is, what search technology to use together with the rails + elasticsearch bundle?
Or maybe there is a bunch of redis + dictionary files or elasticsearch + dictionary files and output using javascript?
I really appreciate your help in this matter.)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Taratin, 2016-02-15
@monaxide

Do you need only autocomplete categories?
Then it's easier to do it on pure js on the client.
We run the request through the stemmer https://github.com/NaturalNode/natural
We wrap it in a regular expression in the style of *(truncated word from the request)*/gi - searching for phrases is also possible, think for yourself.
And we are looking for it in the text from the concatenation of all category names, including synonyms.
We check the resulting matches in a dictionary. Like object keys.
{
c2d : 'core 2 duo'
}
If the key is found, then replace it with the value.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question