You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Johnbin Wang <jo...@gmail.com> on 2011/05/09 05:59:11 UTC

How do I sort lucene search results by relevance and time?

What do I want to do is just like Google search results.  The results in the
first page is the most relevant and also recent documents, but not
absolutely sorted by  time desc.

-- 
cheers,
Johnbin Wang

Re: How do I sort lucene search results by relevance and time?

Posted by Otis Gospodnetic <ot...@yahoo.com>.
If only you were using Solr.... 
http://wiki.apache.org/solr/DisMaxQParserPlugin#bf_.28Boost_Functions.29


Otis
----
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch
Lucene ecosystem search :: http://search-lucene.com/



----- Original Message ----
> From: Johnbin Wang <jo...@gmail.com>
> To: java-user@lucene.apache.org
> Sent: Sun, May 8, 2011 11:59:11 PM
> Subject: How do I sort lucene search results by relevance and time?
> 
> What do I want to do is just like Google search results.  The results in  the
> first page is the most relevant and also recent documents, but  not
> absolutely sorted by  time desc.
> 
> -- 
> cheers,
> Johnbin  Wang
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: How do I sort lucene search results by relevance and time?

Posted by Johnbin Wang <jo...@gmail.com>.
Thanks for your suggestion!

 I try to set document boost factor when indexing document. In order to
bubble up recent documents' scores, I set last three month's documents'
boost to 2 , and set other documents' boost factor to 0.5. The I search
index sorting by two fields, lucene default score and time desc. The sorting
results seem good. It meet my requirement.

On Mon, May 9, 2011 at 6:31 PM, Ian Lea <ia...@gmail.com> wrote:

> Well, you can use one of the sorting search methods and pass multiple
> sort keys including relevance and a timestamp.  But I suspect the
> Google algorithm may be a bit more complex than that.
>
> One technique is boosting: set an index time document boost on recent
> documents.  Of course what is recent today may not be next week.
> There are other, more complex ways of customizing lucene scoring.  A
> Google search for something like "customized lucene scoring" will find
> lots of info, some recent, some older, but probably all relevant one
> way or another.
>
>
> --
> Ian.
>
>
> On Mon, May 9, 2011 at 4:59 AM, Johnbin Wang <jo...@gmail.com>
> wrote:
> > What do I want to do is just like Google search results.  The results in
> the
> > first page is the most relevant and also recent documents, but not
> > absolutely sorted by  time desc.
> >
> > --
> > cheers,
> > Johnbin Wang
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
cheers,
Johnbin Wang

Re: How do I sort lucene search results by relevance and time?

Posted by Ian Lea <ia...@gmail.com>.
Well, you can use one of the sorting search methods and pass multiple
sort keys including relevance and a timestamp.  But I suspect the
Google algorithm may be a bit more complex than that.

One technique is boosting: set an index time document boost on recent
documents.  Of course what is recent today may not be next week.
There are other, more complex ways of customizing lucene scoring.  A
Google search for something like "customized lucene scoring" will find
lots of info, some recent, some older, but probably all relevant one
way or another.


--
Ian.


On Mon, May 9, 2011 at 4:59 AM, Johnbin Wang <jo...@gmail.com> wrote:
> What do I want to do is just like Google search results.  The results in the
> first page is the most relevant and also recent documents, but not
> absolutely sorted by  time desc.
>
> --
> cheers,
> Johnbin Wang
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org