An other way to prevent your indexsearch from reopened everytime you delete an document is to use a global delete filter which excludes all deleted documents from being retrieved e.g. included in your search results. That won't work with updates without using a buffer or something similar but if you have to deal only with deletes a filter would do the job and the indexsearcher will remain open until you commit an update or insert (thats what you would call it in a db context, remember lucene is a reverse index not a database).
best regards simon On 9/8/06, Michael McCandless <[EMAIL PROTECTED]> wrote:
jacky wrote: > There is a question about delete operation, i have not found any doc in lucene api's javadoc: > When using delete(Term term) of IndexReader and commit, at the same time, an indexSearcher is open.So the deleted document still can be seached till reopen the indexSearcher, i don't know how lucene did this. > So when the lucene database is updated, how to notify to reopen the IndexSearcher since there may be several applications to search this lucene database? Lucene doesn't actually have any builtin ability to "notify" all other searchers that they should re-open. So you have to do this part yourself. However, the IndexReader class has an "isCurrent()" method, which you could periodically call (say once every N minutes or something) to check if it's time to re-open. Mike --------------------------------------------------------------------- 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]