问题描述:

I have an Asp.Net MVC app and I am looking into implementing a search engine that will search for individuals. I would like to use Nhibernate Search & Lucene.Net as this will keep the index in sync when an individual is inserted or updated, resulting in changes being visible when a user runs a search.

The issue I have is what if multiple users are updating the index at the same time, how does Nhibernate Search handle this? Is Lucene responsible for locking?

Any help will be greatly appreciated.

Regards

Spam

网友答案:

I believe this post may answer your question:

Does Lucene.Net manage multiple threads accessing the same index, one indexing while the other is searching?

Thanks,

Hal

网友答案:

Lucene.NET will handle locking for you, however running several Applications might have colliding locks since the all instances store the lockfile in the temp-folder.

This was fixed in Lucene 2.3 or something, where they started to store the lockfile in the basedir (where all index-files resides), by default.

Although, I think an index-write during a search or write from another thread/process will throw an exception, therefor it would be wise to handle that accordingly (for instance, queue an update for that entity).

相关阅读:
Top