0

How do I include a ranking type (such as SPH_RANK_NONE) in a Sphinx RT query?

select id from my_index where match('hello') 
order by date
limit 600 ;  

Also, is there a way to just set it once, for example, in the config file?

Sphinx doc: http://sphinxsearch.com/blog/2010/08/17/how-sphinx-relevance-ranking-works/

user984003
  • 28,050
  • 64
  • 189
  • 285

1 Answers1

2

The default ranking mode is SPH_RANK_PROXIMITY_BM25 and it can't be changed using config.

This is how you set a ranking mode for a query (note that ORDER BY must have explicit ASC/DESC order clause):

SELECT id FROM my_index where MATCH('hello') 
     ORDER BY date DESC LIMIT 600 OPTION ranker=sph04;

Relevant parts in the doc:

http://sphinxsearch.com/docs/current.html#weighting http://sphinxsearch.com/docs/current.html#sphinxql-select

hank
  • 9,553
  • 3
  • 35
  • 50
  • Perfect, thanks! For SPH_RANK_NONE I used ranker=none. Made my queries faster :) No reason to use ranking when I'm sorting by date anyway. – user984003 May 22 '17 at 12:31