R
R
rloprlorpr2019-07-12 11:02:28
Sphinx
rloprlorpr, 2019-07-12 11:02:28

How can I set up the index and search to just look for the exact substring like "%test%"?

It is necessary that the sphinx simply works like like in mysql and looks for an occurrence of an exactly given string, up to spaces, periods, etc.
For example:

where field like "%тостер   нереально крутой site!!1,.%"

It is necessary that nothing matches and is not replaced, but simply the entire given string is dutifully searched.
What configs to specify, alphabet, etc. in the sphinx and index, how to achieve this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2019-07-13
@ghostiam

Set index settings:

min_word_len = 1
min_infix_len=2 # минимум 2

Add all special characters to charset_table.
Spaces may not work in charset_table and they will have to be replaced with another character (I need to test, I don’t remember exactly, but it seems like the documentation allows you to use a space through unicode, like U + 20).
And the request will look something like this:
or like this, if you have to use a replacement:
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, \
    U+002D, U+003A, U+002B, U+0028, U+0029
    # А..Я->а..я, а..я, Ё->ё, ё, 
    # -, :, +, (, )

Documentation:
min_infix_len
min_word_len
charset_table

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question