Why is my Lucene index getting locked?

Posted by Andrew Bullock on Stack Overflow See other posts from Stack Overflow or by Andrew Bullock
Published on 2010-02-26T11:22:13Z Indexed on 2010/03/22 1:21 UTC
Read the original article Hit count: 494

Filed under:
|

I had an issue with my search not return the results I expect.

I tried to run Luke on my index, but it said it was locked and I needed to Force Unlock it (I'm not a Jedi/Sith though)

I tried to delete the index folder and run my recreate-indicies application but the folder was locked. Using unlocker I've found that there are about 100 entries of w3wp.exe (same PID, different Handle) with a lock on the index.

Whats going on?

I'm doing this in my NHibernate configuration:

c.SetListener(ListenerType.PostUpdate, new FullTextIndexEventListener());
c.SetListener(ListenerType.PostInsert, new FullTextIndexEventListener());
c.SetListener(ListenerType.PostDelete, new FullTextIndexEventListener());

And here is the only place i query the index:

var fullTextSession = NHibernate.Search.Search.CreateFullTextSession(this.unitOfWork.Session);

var fullTextQuery = fullTextSession.CreateFullTextQuery(query, typeof (Person));
fullTextQuery.SetMaxResults(100);

return fullTextQuery.List<Person>();

Whats going on? What am i doing wrong?

Thanks

© Stack Overflow or respective owner

Related posts about lucene

Related posts about nhibernate