The document is indexed first. This is required by the application.
Based on Lucene in Action", "Optimizaation" is to  merge multiple index
files together in order to reduce their number and thus minimize the
time it takes to read at search time"
The approach1 does deletion on an optimized index. So, the number of
index files are the same as before the deletion.

-----Original Message-----
From: Mordo, Aviran (EXP N-NANNATEK) [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 08, 2005 1:16 PM
To: java-user@lucene.apache.org
Subject: RE: delete and optimize

Well the best way in my opinion is to: 

1) open the IndexReader and delete some documents from the same index

2)     close the IndexReader

3)     open IndexWriter and index documents

4)     optimize the indexWriter and close the indexWriter

For best performance you want the optimization to be that last operation


HTH

Aviran
http://www.aviransplace.com

-----Original Message-----
From: Dan Liu [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 08, 2005 11:24 AM
To: java-user@lucene.apache.org
Subject: delete and optimize

Hi,

 

What is the difference between following approaches?

 

Approach1

1)     open IndexWriter and index documents

2)     optimize the indexWriter and close the indexWriter

3)     open the IndexReader and delete some documents from the same
index

4)     close the IndexReader

 

Approach2

1)     open IndexWriter and index documents

2)     close the IndexWriter

3)     open the IndexReader and delete some documents from the same
index

4)     close the IndexReader

5)     open the IndexWriter again

6)     optimize the indexWriter and close the indexWriter

 

The Approach1 is definitely faster than Approach2. The difference is
that the Approach1 does not renumber the document nubmer. While with the
Approach2, the document nubmer reflects the renumbered doucements. In
other words, that reader.maxDoc() gives different result between
Approach1 and 2.

 

Since the optimize only affects the search speed, will I have any
performance diffenece between these approaches while searching? (note:
the documents are actually deleted when IndexReader is closed)

 

Thanks /dan

 



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