You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Supun Edirisinghe <su...@office.vtourist.com> on 2004/04/29 01:41:17 UTC

Documents the same search is done many times.

what happens in this situation:

I query a field "id" for "one"

say I get a Document object (object A) from a search which has a field
"content" with value "pig". and that object persists forever.

then a new index is written with a document with "id"="one" and
"content"="mongoose"

another search does the same search querying "id" for "one". will this
new search return the same object A or a new object?

if they are different, will examining object A show that the "content"
field has changed?

thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


RE: Documents the same search is done many times.

Posted by "Nader S. Henein" <ns...@bayt.net>.
The short answer is, it's up to you :-)  Lucene doesn't know which document
is your primary key (you're thinking like a DB programmer) id you ad the new
document with ID="one" without deleting the old one from the index then when
you search you'll get two documents "pig" and "mongoose" but if you delete
all documents with ID="one" then index you're new document then you'll only
get "mongoose", From a DBA perspective Lucene is like a table with a unique
ID on each document (that being the Lucene assigned DOC ID (which changes
every time you optimize, but nevertheless remains unique) and then all other
columns weather indexed, tokenized, stored or not, can bare repetition, so
if you want to implement a unique key like ID on your Lucene index, you 'll
have to do a little delete based on that ID field every time you insert a
new document into the index, quite simple and I've been doing it or a few
years now without fail.

Hope this helps

Nader Henein



---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org