RE: Selecting the maxium/highest numerical value from a lucene Index)

2006-01-24 Thread Allan Dewar
cting the maxium/highest numerical value from a lucene Index) On 1/23/06, Chris Hostetter <[EMAIL PROTECTED]> wrote: > use a TermEnum to iterate over all the values of the field, > remembering the "previous" value each time untill you run out of > values Bummer that y

Re: Selecting the maxium/highest numerical value from a lucene Index)

2006-01-23 Thread Yonik Seeley
On 1/23/06, Chris Hostetter <[EMAIL PROTECTED]> wrote: > use a TermEnum to iterate over all the values of the field, remembering > the "previous" value each time untill you run out of values Bummer that you can't step backwards with a TermEnum... finding the first term is cheap, but finding the la

Re: Selecting the maxium/highest numerical value from a lucene Index)

2006-01-23 Thread Chris Hostetter
: 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 us

RE: Selecting the maxium/highest numerical value from a lucene Index)

2006-01-23 Thread Gwyn Carwardine
I'm only a novice at these things but if I had to do that right now? I'd add a document that represents that primary key with a value representing the next available number and everytime I go to do some additions I'd get it, use the value and then delete and re-add that document with the revised ne