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 next
available number. As only one index writer can be open at a time it would
seem a reasonable solution.

-Gwyn 

-----Original Message-----
From: Allan Dewar [mailto:[EMAIL PROTECTED] 
Sent: 23 January 2006 15:47
To: java-user@lucene.apache.org
Subject: Selecting the maxium/highest numerical value from a lucene Index)

Hi

A database is used as our primary data store.  Our lucene index is then
created and updated from this database.

We store the value of the database primary key in the lucene index as we
need to be able to identify documents across the database and lucene
index.

New documents are inserted into the database on a daily basis and this
is not necessarily a batch process.

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

(The database equivalent of SELECT MAX(id) FROM CONTRACTS)

I would then be able to add documents to the lucene index from the
database whose primary key is greater than the highest primary key value
already in the index.

SELECT * FROM contracts WHERE id > maximumIdInLuceneIndex

Is there a standard approach to achieve this?

Aldo


****************************************************************************
This e-mail (and any attachment) is intended only for the attention of the
addressee(s). Its unauthorised use, disclosure, storage or copying is not
permitted. If you are not the intended recipient, please destroy all copies
and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be monitored,
recorded and retained by BiP Solutions Ltd. 
E-mail monitoring/ blocking software may be used, and e-mail content may be
read at any time.You have a responsibility to ensure laws are not broken
when composing or forwarding e-mails and their contents.
****************************************************************************

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



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

Reply via email to