You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Peter Thygesen <th...@infopaq.dk> on 2008/01/18 17:04:29 UTC

LIFO, Last In First Out, sort by date desc

In Solr Relevancy FAQ if found a "solution" for boosting newer
document... However a newbie dumb ass like me can't get it to work.. :( 

I want to query solr and have it show me results by date desc. (date is
a field)

I suppose I can use the explicit sort.. but FAQ talks about boosting and
I would like to try that too. I don't know what "qf", "mm" ect. I should
set. 

This is what I tried, but didn't get "date desc" result. (I've tried
other values and leaving out attributes, but soo far.. no luck)

<requestHandler name="/test" class="solr.DisMaxRequestHandler" >
        <lst name="defaults">
                <str name="echoParams">explicit</str>
                <str name="qf">body^1 headline^1</str>
                <str name="bq">recip(rord(date),1,1000,1000)</str>
                <str name="fl">id,headline,date,score</str>
        </lst>
  </requestHandler>


Hope someone has the time to help a newbie.. :|

\Peter




Re: LIFO, Last In First Out, sort by date desc

Posted by Yonik Seeley <yo...@apache.org>.
On Jan 18, 2008 11:04 AM, Peter Thygesen <th...@infopaq.dk> wrote:
> In Solr Relevancy FAQ if found a "solution" for boosting newer
> document... However a newbie dumb ass like me can't get it to work.. :(
>
> I want to query solr and have it show me results by date desc. (date is
> a field)

Something like bf (boost function) influences the full-text relevancy
score, it doesn't override it.
I think what you want may be a strict sort by date.

sort=date desc

> I suppose I can use the explicit sort.. but FAQ talks about boosting and
> I would like to try that too. I don't know what "qf", "mm" ect. I should
> set.

Docs are here: http://wiki.apache.org/solr/DisMaxRequestHandler
Try changing "bq" to "bf" below (bq is boost query in lucene syntax,
bf is boost function)
It's hard to get the balance right though... I wouldn't necessarily
take this approach unless a strict sort by date doesn't work for you.

-Yonik

> This is what I tried, but didn't get "date desc" result. (I've tried
> other values and leaving out attributes, but soo far.. no luck)
>
> <requestHandler name="/test" class="solr.DisMaxRequestHandler" >
>         <lst name="defaults">
>                 <str name="echoParams">explicit</str>
>                 <str name="qf">body^1 headline^1</str>
>                 <str name="bq">recip(rord(date),1,1000,1000)</str>
>                 <str name="fl">id,headline,date,score</str>
>         </lst>
>   </requestHandler>
>
>
> Hope someone has the time to help a newbie.. :|
>
> \Peter