lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Liu" <d...@tridsys.com>
Subject delete and optimize
Date Thu, 08 Dec 2005 16:23:49 GMT
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

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message