Sorry, I forgot to say that I was talking about Lucene.Net 2.3.1
In Version 2.3.1, IndexWriter class has UpdateDocuments and DeleteDocuments
methods. So you don't have to use
IndexModifier to add or delete documents.

(IndexModifier is a wrapper for IndexWriter+IndexReader. If you call
AddDocument it closes IndexReader(if open), opens the IndexWriter and calls
its AddDocument method. If you want to delete a document it closes the
IndexWriter(if open), opens the IndexReader and then calls its
DeleteDocuments method. So it is not an efficient implementation. Therefore
I don't think that having one instance of IndexModifier will change things
much)

>In the sample code, and my code, I see that there's a call to "Close" on
IndexSearcher.   Should I
>omit that call, and leave it always open?

Again for 2.3.1, IndexSearcher will not "see" the updates made by
IndexWriter unless you reopen it.

DIGY


-----Original Message-----
From: Corey Trager [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 12, 2008 12:52 AM
To: lucene-net-user@incubator.apache.org
Subject: RE: Multiple threads updating/reading the same index in an ASP.NET
website. - IndexModifier

And, the same with IndexModifier, right?  I should have one single instance
of it and all threads
use that same instance?

--- Digy <[EMAIL PROTECTED]> wrote:

> Yes Lucene has build-in concurrency management. You can freely search and
> update the same index in different threads. One point here is that you
have
> to use the same instance of the IndexWriter in updating threads. Trying to
> open the same index twice will throw exception. It is also recommended to
> share a single IndexSearcher across threads for better performance.
> 
> DIGY
> 
> -----Original Message-----
> From: Corey Trager [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, October 11, 2008 7:36 PM
> To: lucene-net-user@incubator.apache.org
> Subject: Multiple threads updating/reading the same index in an ASP.NET
> website.
> 
> Does Lucene.Net have built into it logic for managing concurrency,
multiple
> threads?   If a
> request comes to my website that triggers a thread to update the index,
and
> another request comes
> on another thread that also triggers a request to update, or even read,
the
> index, does Lucene
> handle the management of concurrency, or do I need to?
> 
> 
>       
> 
> 



      

Reply via email to