Answer the question
In order to leave comments, you need to log in
How do I set up Sphinx to search by tags and display relevancy results?
Good afternoon!
We have the task of doing a search in the database of spare parts from suppliers, it is as follows:
Our company is engaged in the repair of mobile equipment and when a client calls
by type of service and type of model, we need to search the database of suppliers (which are already filled in and
indexed by sphinx).
Example:
iPhone 5s Display replacement
We refer to our tag database where the following tags are registered for the Display Replacement service:
(display, touchscreen, assembly, lcd, touch, digitizer, and so on, let's say 10 tags)
Next, we split the brand name and model by spaces on tags - that is, an array of
tags is obtained:
{iPhone, 5s, display, touchscreen, collection, lcd, touch, digitizer}
We need the search to be based on tags, and the results of the TOP 100 relevant by
relevance are displayed.
Even if we say we have 300 lines in the database, of which if we search by tags so that all the
tags are in the lines - even if there are 50 of them, then the remaining 50 should be shown anyway
(even if at least 1 tag is not found) - then there is a need for a conclusion on relevance. If
, for example, we output 300 rows, then all rows from the database will be displayed, but they will be shown
according to relevance (the number of occurrences of tags, that is, a row with 10 tags will be in
1 place, from 9 to 2, and so on.)
We just can’t understand how to setup config.
Please help us, thanks in advance!
Answer the question
In order to leave comments, you need to log in
sphinx by default sorts by relevance, or you suspect irrelevance under relevance.
It seems to me that on your volumes it is easier to do a search using the SQL server than to connect the sphinx.
But if you still want Sphinx, then just create an index in the config that is obtained using sql query tools and look for the id of the records ordered by relevance (there are several native rankers in the dock, I think one of them will suit you well, or write your custom one). After that, all you need to do is just get records from the database by Id and provide it to the user.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question