D
D
devilsD2020-12-01 17:39:39
Sphinx
devilsD, 2020-12-01 17:39:39

How to configure sphinx search so that word order is not taken into account?

Here is the index config:


index catalog
{
source = catalog
path = /path

morphology = stem_enru

min_word_len = 1
min_prefix_len = 0
min_infix_len = 2
enable_star = 1
expand_keywords = 1
}

There are results for the query "white gold", if you change the order of the words "gold white" - there are no results.

using yii2
$rows = $query->from('catalog')
            ->match(new MatchExpression(':match', [
                'match' => $q,
            ]))
            ->all();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
devilsD, 2020-12-01
@devilsD

The problem was not in the settings of the sphinx, but in the request itself. If the string is wrapped in a MatchExpression, then in the sql query it turns out like this: If you do not use MatchExpression, then the query does not contain brackets, and the search works as it should.
WHERE MATCH('\"Search str\"')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question