lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Liu" <d...@tridsys.com>
Subject RE: delete and optimize
Date Thu, 08 Dec 2005 18:59:44 GMT
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:aviran.mordo@lmco.com] 
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:dliu@tridsys.com] 
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


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


Mime
View raw message