K
K
kolossus2017-05-27 15:39:15
Sphinx
kolossus, 2017-05-27 15:39:15

Why does Sphinx search not for a query, but for parts of it?

Good afternoon!
There is a fairly large database of contractors, you do not always know exactly the name of the counterparty you need to find.
Therefore, we decided to organize a search using sphinxsearch-2.2.11_1 Let's
say we are looking for a driver - it finds both drivers and drivers , etc. It feels good.
But in some requests "something is wrong" happens.
For example, we search for 'Sayans' by request - in addition to the most found Sayany, it finds a bunch of everything that starts with 'sa'. We ask:
select * from test1 WHERE MATCH('саяны');

call keywords('саяны', 'test1', 1);
+------+------------+------------+------+------+
| qpos | tokenized  | normalized | docs | hits |
+------+------------+------------+------+------+
| 1    | саяны      | са         | 39   | 43   |
+------+------------+------------+------+------+

It turns out that when searching for 'Sayan' sphinx turns out to be looking for 'sa'.
As a result, he finds what he needs in the database - several contractors with the name 'Sayans' and a bunch of others like OOO "Transporttech" SA O.
What to do? How to get correct search results? What's wrong with the config?
sphinx config
source src1
{
        type                    = mysql
        sql_host                = localhost
        sql_query_pre           = SET NAMES utf8
        sql_query_pre           = SET CHARACTER SET utf8
        sql_query               = SELECT id, name FROM contragent
}
index test1
{
        source                  = src1
        path                    = /var/db/sphinxsearch/data/test1
        docinfo                 = extern
        dict                    = keywords
        mlock                   = 0
        morphology              = stem_enru
        charset_table = 0..9, A..Z->a..z, _, a..z, \
            U+410..U+42F->U+430..U+44F, U+430..U+44F, U+401->U+451, U+451
        min_word_len            = 3
        ignore_chars            = U+00AD
        min_infix_len           = 2
        html_strip              = 0
}


Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Puma Thailand, 2017-05-27
@opium

Because you have enabled search for at least two letters, look in my profile on Habré for an article about searching for a sphinx, it is explained in detail there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question