Markus,
What you were thinking is fine - search and, if found, delete first, then add.  
Lucene allows duplicate and offers no automated way for avoiding them.

Otis
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Simpy -- http://www.simpy.com/  -  Tag  -  Search  -  Share

----- Original Message ----
From: Markus Franz <[EMAIL PROTECTED]>
To: java-user@lucene.apache.org
Sent: Sunday, March 18, 2007 3:10:36 PM
Subject: Eliminate duplicates

Hello!

An excerpt from my Lucene use:

Document document = new Document();
document.add(new Field("title", item.title, Field.Store.YES, =
Field.Index.TOKENIZED));
document.add(new Field("desc", item.desc, Field.Store.YES, =
Field.Index.TOKENIZED));
writer.addDocument(document);
writer.optimize();

My problem is: I can add the same entry twice times. How can I avoid = this by 
checking the title? (Of course I thought of doing a search query = for the 
title before inserting, but isn't there a more cool way?)

Markus


---------------------------------------------------------------------
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