Lucene indexer in service, results from web application.

Nov 3, 2011 at 2:19 PM

I'm wondering if anyone can point me in the right direction? I am using Simol in a web application that also has a companion windows service for long running processes, handling a message bus, etc... I currently have the Lucene indexer running in a background thread on my web application and all is well for full-text indexing. 

However, I've tried to move the indexer to the companion service and then just set the config options to point the web application to the same index store that the service is setup with.

I consistently get the following error when trying to perform a search from the web application:

"Lock obtain timed out: SimpleFSLock@[[MyIndexLocation]]\LuceneIndexes\ContactableEntity\write.lock"

Could anyone shed any insight on this problem? Have I shared enough information?

Thanks,

Hal

 

Coordinator
Nov 3, 2011 at 5:29 PM

To make this work you'll need to customize the default indexer. You can do this by creating your own IIndexer class based on Simol.Indexing.LuceneIndexer and plugging it in at SimolConfig.Indexer.

The cause of your problem is that the default indexer opens an index writer when you search a domain. That's causing a conflict because two processes are attempting to write to the same index. Opening a writer when searching is done because Lucene will throw an exception if you search a non-existent index--opening the writer when searching ensures that the index always exists before performing a search.