lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Per Lindberg" <...@implior.com>
Subject SV: Find "latest" document (before a certain date)
Date Wed, 29 Aug 2007 10:29:45 GMT
 
> Från: Karl Wettin [mailto:karl.wettin@gmail.com] 
> 28 aug 2007 kl. 17.48 skrev Per Lindberg:
> 
> > Now, I want to search the content, and return only the
> > LATEST found document with each id. To complicate
> > things a bit, I want the latest before a given date. In other
> > words, for each id pick only the one with the highest date
> > less than x.
> 
> Given you added documents with version time stamp in chronological
> order, how about using a RangeQuery and pick the hit with the
> greatest document number?

Yep, that did the trick! There seems to be no Filter that can do
the final picking of the highest date, so I had to do that after the
search.

I use IndexSearcher.search with a RangeFilter,
I presume that's just as efficient as a RangeQuery?

Thanks!
Per



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


Mime
View raw message