You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose moving the functionality of deleting a document from the index from
IndexReader to IndexWriter, not only because because it is misleading that a
reader modifies the index, but also because of the following problem:
I have a website index, that should be updated but that should also be available
for searching while updating. So I open an IndexReader for searching the index
for a specific document and for deleting an outdated document from the index and
I open an IndexWriter to add updated documents to the index. But there is a
conflict between the locks of those two instances. If I want to update a
document, I have to close the IndexWriter (because otherwise IndexReader could
not obtain the lock for writing to the index) and the IndexReader (because it
would complain if the index was modified since opening the reader). Then I have
to create a new reader to delete the document from the index, and I have to
close this reader as it does not release the write lock after deleting a
document, so I would not be able to open an IndexWriter. And now I can open a
fresh IndexWriter for adding the new document again and a fresh IndexReader for
searching the index for the next document.
You see, in the worst case (every document has been modified) the program is
only opening and closing readers and writers all the time.
If the IndexWriter deleted documents from the index, only this instance would
need a write lock and I could only use one IndexReader and one IndexWriter for
updating the whole index.
If you know a better way to update the index, then let me know.
Tilman Giese
Migrated from LUCENE-273 by Tilman Giese, resolved May 27 2006
Environment:
Operating System: other
Platform: Other
The text was updated successfully, but these errors were encountered:
Having delete functionality in IndexReader and not in IndexWriter is a design
decision that cannot be changed easily. For an explanation and for a discussion
on updating of documents see developer list around July 16, subject:
"Deleting a document with an IndexWriter open".
.
Christoph
I propose moving the functionality of deleting a document from the index from
IndexReader to IndexWriter, not only because because it is misleading that a
reader modifies the index, but also because of the following problem:
I have a website index, that should be updated but that should also be available
for searching while updating. So I open an IndexReader for searching the index
for a specific document and for deleting an outdated document from the index and
I open an IndexWriter to add updated documents to the index. But there is a
conflict between the locks of those two instances. If I want to update a
document, I have to close the IndexWriter (because otherwise IndexReader could
not obtain the lock for writing to the index) and the IndexReader (because it
would complain if the index was modified since opening the reader). Then I have
to create a new reader to delete the document from the index, and I have to
close this reader as it does not release the write lock after deleting a
document, so I would not be able to open an IndexWriter. And now I can open a
fresh IndexWriter for adding the new document again and a fresh IndexReader for
searching the index for the next document.
You see, in the worst case (every document has been modified) the program is
only opening and closing readers and writers all the time.
If the IndexWriter deleted documents from the index, only this instance would
need a write lock and I could only use one IndexReader and one IndexWriter for
updating the whole index.
If you know a better way to update the index, then let me know.
Tilman Giese
Migrated from LUCENE-273 by Tilman Giese, resolved May 27 2006
Environment:
The text was updated successfully, but these errors were encountered: