: What is the easist way to identify the maximum or highest primary key
: value in the lucene index?

The most straight forward way is to do a search for all documents, ordered
by the field you are interested in, and then get the value out of hte
first document.

Under the covers, sorting works using the FieldCache -- a more efficient
way to do what you want then searching would be to use the FieldCache
for your ID field directly, and get the largest value out of the array.

If you don't want to have a giant array of all the ids in memory, you can
use a TermEnum to iterate over all the values of the field, remembering
the "previous" value each time untill you run out of values -- and now
your "previous" value is the highest.



-Hoss


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

Reply via email to