Sort by the internal Lucene document ID and pick the highest one. That might do the job for you.
Otis
--
Sematext --
http://sematext.com/ -- Lucene - Solr - Nutch
----- Original Message ----
> From: vivek sar <
vivextra@...>
> To: solr-user <
solr-user@...>
> Sent: Wednesday, July 8, 2009 8:34:16 PM
> Subject: Boosting for most recent documents
>
> Hi,
>
> I'm trying to find a way to get the most recent entry for the
> searched word. For ex., if I have a document with field name "user".
> If I search for user:vivek, I want to get the document that was
> indexed most recently. Two ways I could think of,
>
> 1) Sort by some time stamp field - but with millions of documents this
> becomes a huge memory problem as we have seen OOM with sorting before
> 2) Boost the most recent document - I'm not sure how to do this.
> Basically, we want to have the most recent document score higher than
> any other and then we can retrieve just 10 records and sort in the
> application by time stamp field to get the most recent document
> matching the keyword.
>
> Any suggestion on how can this be done?
>
> Thanks,
> -vivek