S
S
Silentium2011-08-17 17:05:15
PHP
Silentium, 2011-08-17 17:05:15

Attribute weighting in Sphinx?

I set up a search on the site. It is necessary that documents with a certain boolean attribute go to the end of the list, but with an exact hit, they are on the first page.
Now there is this:

$sphinx->SetSortMode(SPH_SORT_EXTENDED, 'available DESC, priced DESC, @weight DESC');

But I want pages with attribute 0 not to go to the end, but their weight simply decreases.
Is there a possibility to implement this? Search mode EXTENDED2.
I shoveled a mountain of documentation, blogs, forums, but did not find an answer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shedar, 2011-08-17
@silentium

Form an expression that takes into account the value of the attribute and the weight of the document. For example something like
@weight*IF(@myAttr, 1, 0.3)
and use SPH_SORT_EXPR for sorting.
sphinxsearch.com/docs/manual-2.0.1.html#sort-expr

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question