D
D
dmitry_d2020-08-08 12:53:17
Sphinx
dmitry_d, 2020-08-08 12:53:17

How to implement search in an online store using Sphinx?

The task is to improve the search on the site dollsempire.ru. Based on the analysis of search queries on the site, it was decided that a search structure of several stages would be more suitable:

1st stage of the search: exact search on a truncated index (perhaps compiled mostly by hand) that will match popular queries/tags/categories/etc and "landing pages" for them. For example, for the request "lol omg", the page https://dollsempire.ru/lol_suprise_omg.html
was immediately opened, or a grid was opened with suitable products already filtered by some attribute and "squeezed filters" nearby, as, for example, on the site https:// www.mvideo.ru/product-list-page-cls?q=ipho...
To create this index, we will make a detailed markup of the pages "page id", products "product id" and categories / tags.

2nd stage: inaccurate dictionary search / large index search. For example, often people enter a long phrase (apparently copied in advance) like "Avia Trotter Doll - Avea Trotter, Monster School" - it is obvious that a specific doll is also needed. But in our "truncated index" we most likely will not have such a phrase with the corresponding link, because the phrase is too long, but in the "large index", compiled automatically, such a phrase is found with more than 99% match. In this case, it also makes sense to open a specific page that matches this request.

3rd stage: if stages 1 and 2 are unsuccessful, a ranked list of results is issued (like now).

The question is: how can this be done using the standard Sphinx settings (or with minor modifications)?

Additional question: ideally, I would like to add "typo" and "hints" to the search. Are there any out-of-the-box solutions that go with Sphinx for this?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ivan Shumov, 2020-08-08
@inoise

Take Algolia. It's too early for you with such Sphinx and ElasticSearch queries)

X
xmoonlight, 2020-08-08
@xmoonlight

This is definitely not implemented by Sphinx.
I stopped using ready-made engines a long time ago, because. their quality is the worst.
What can I advise: look in the direction of splitting the search string into separate data types, compare two strings (from the database and what was entered in the search) by the smallest length, find the "distance" between words, calculate the total "weight" of all words for each of two strings being compared, use a synonym dictionary.
"Typo" and "hints" - will be available automatically if you correctly learn how to calculate the "weight" of the lines.

P
Puma Thailand, 2020-08-08
@opium

It's all a full implementation on the side of the store, in total a few hundred lines of code.

S
Sergey Tikhonov, 2020-08-09
@tumbler

Do consistently three queries to different indexes, differently composed and differently processed. Add typo corrections and hints , and that's it. You don't need any special "functionality" out of the box.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question