views:

244

answers:

3

I want to be able to search by multiple clients and index at the same time in Lucene.Net

Is it possible and thread safe?

Can the same instance of IndexSearcher be shared across threads?

+1  A: 

Yes.Very much.
Even indexing is!

Cherian
A: 

You can index and search concurrently, but the changes you make to the index will not be visible to the searcher till you re-create the searcher. Searcher will have the snapshot of the index when you created the searcher object.

Shashikant Kore
+1  A: 

The index search CAN and SHOULD be shared across threads.

The trick is deciding when to refresh your searcher with a new snapshot of the index.

I wrote an article showing how I coded sharing a searcher across threads while at the same time making sure that the searcher was always using an up-to-date index.

I'm not saying my solution is the best for everybody - I don't think it would be good for a website with a huge number of searches going on - but it's working fine for my low volume application.

Here's the article:

http://ifdefined.com/blog/post/Full-Text-Search-in-ASPNET-using-LuceneNET.aspx

Corey Trager
Thanks and by the way we use Bugtracker.Net :)
Rohit