S
S
sps17352014-02-18 21:22:46
Sphinx
sps1735, 2014-02-18 21:22:46

How in Sphinx to consider ctr when searching?

There is a base with fields id, title, description and ctr (float type). ctr=clicks/impressions and recalculates once per minute.
indexer --all --rotate runs every 10 minutes.
sphinx.conf

sql_query = SELECT id, title, description, ctr FROM posts
sql_attr_float = ctr

I make a query on sphinxQL
$sphinx_sql = " SELECT * FROM sphinxdata WHERE  MATCH ('\"$search_key\"/1') LIMIT 500 OPTION ranker=proximity_bm25 ";

Then I get the list of $ids and get the rest of the data . How can I take into account ctr in the $sphinx_sql query? Those. so that the results are something like ORDER BY (ctr*weight) DESC, where weight is the weight that sphinx calculates.
$sql = " SELECT * FROM posts WHERE id IN ($ids) ";

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sps1735, 2014-02-19
@sps1735

@portfelio thanks. And so he did. It turned out that it was necessary to update 2.0.8 to 2.1.5 manually. There some bug with ORDER BY was corrected.
And yet this request was incorrect:
It is necessary:
I understand correctly that sorting by super_ctr occurs after the data and weight are received?
And in order to take ctr into account when receiving data, you need to rewrite the formula inOPTION ranker=

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question