On Aug 25, 2004, at 11:39 AM, Bernhard Messer wrote:

If you already store the date time when the doc was index, you could use the following trick to get the last document added to the index:

while (--maxDoc > 0) {

Yes, but that's a linear search :(

On Aug 25, 2004, at 11:25 AM, Otis Gospodnetic wrote:

What if all Documents in your index contained some flag field + an 'add
date' field.  Then you could make a query such as: flag:1 and sort it
by 'add date' field, taking only the very first hit as the most
recently added Document.

That's a very clever approach. I'm currently using Lucene 1.3, so I hadn't thought about using the new sorting abilities. I'd need to move to 1.4, of course.


A question, though: how efficient is it to make a query that matches all documents and then sort it? I'm looking for something as small as I can; after all, storing the last date in a file separate from the index is O(1)...

Thanks!

Avi

--
Avi 'rlwimi' Drissman
[EMAIL PROTECTED]
Argh! This darn mail server is trunca


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to