0

In my index I've 2 textfield: title & content, and one attribute date_publish.

I want order by

title relevance, publication age, content relevance

With Sphinx 2.0.2 AND SphinxSE

how can do it ? search mode -> expr ? rank_mode -> expr ?

I'm lost..

actually my idea is

bm25(@title)*1000+(1000/ (now()-date_publish)/86400) + bm25(@content)/10

(Note, all this still in limbo I would refine my question withh your comments and results of my experiences ;-)

Moosh
  • 386
  • 1
  • 8

1 Answers1

0

I dont think you can get 'relevance' factors per field as such, so cant explicitly sort like that.

But can use field weights to alter the 'per field' weight, so that title could have a greater effect than content.

You can then either use a ranking expression to factor in the 'age' of the document, similar to your example.

Or could jsut explicitly sort by relevance then sort by date - using extended sort mode.

The other way to sort by reverence, but still promote recent content to the top, is to use 'Time Segment' sorting. see SPH_SORT_TIME_SEGMENTS

barryhunter
  • 20,886
  • 3
  • 30
  • 43
  • currently I use field weights and SPH_SORT_TIME_SEGMENTS and the request for product owner is give more weight if "it's in title than publish date like if I can write ;fieldweights=title,40,publish_date,25,content,2 – Moosh Aug 23 '13 at 13:38
  • so perhaps fieldweights=title,40,content,2;rank=expr:bm25*1000+(NOW()-ressource_date)*10; I'm trying this solution but it's not easy to see if it's works with sphinxse – Moosh Aug 23 '13 at 13:43
  • Note that just using `bm25` in the expression wont take into account field weights (its a document level factor). Perhaps see the expression for SPH_RANK_PROXIMITY_BM25 to see how to factor in user_weight (ie field weights) – barryhunter Aug 23 '13 at 14:24
  • exact since my comment i've replace bm25 by sum(lcs*user_weight)*1000+bm25 (found in manual : SPH_RANK_PROXIMITY_BM25 = sum(lcs*user_weight)*1000+bm25 ) – Moosh Aug 23 '13 at 14:37