lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Per Lindberg" <...@implior.com>
Subject Find "latest" document (before a certain date)
Date Tue, 28 Aug 2007 15:48:18 GMT
Hi!

I have an index containing the following fields

   "id" (not to be confused with the internal Lucene id)
   "version"
   "date"

The combination of "id" and "version" is unique,
i.e. there may be serveral versions of each document
with the same id.

The "date" field indicates when the version was created.

There is also a tokenized "content" field.

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.

I guess I *could* sort the result hits on id and version,
and then write code to scan throgh the hits and pick out
the latest for each id. But I have a hunch that there is a
simpler way. 

Perhaps some homebrew Filter, or other trick. The query
syntax does not seem to support a question like "for each
vaule of the id field among the found hits, give me the one
with the highest date less than x"...

Cheers,
Per Lindberg



---------------------------------------------------------------------
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