Updating NHibernate.Search to Lucene.NET 2.9.2

Skip to first unread message


Jan 20, 2011, 4:05:27 AM1/20/11
to NHibernate Contrib - Development Group

I'm busy trying to compile NHibernate.Search using the latest version
of Lucene.NET (2.9.2).

I've tried compiling NHibernate.Search using the assembly, and aside
from many Obsolete warnings, I only got one error:

FullTextQueryImpl.cs(572,71): 'Lucene.Net.Search.IndexSearcher' does
not contain a definition for 'Reader' and no extension method 'Reader'
accepting a first argument of type 'Lucene.Net.Search.IndexSearcher'
could be found (are you missing a using directive or an assembly

After changing the call to the Reader property to GetIndexReader(),
NHibernate.Search compiles fine.

The next problem was to compile the NHibernate.Search.Tests assembly.

The error here was a missing GetFieldsCount() method on the Lucene.NET
Document class.

I added the following class to this assembly:

using Lucene.Net.Documents;
namespace NHibernate.Search.Tests
public static class DocumentExtensions
public static int GetFieldsCount(this Document doc) {
return doc.GetFields().Count;

This change allows NHibernate.Search.Tests.dll to compile correctly.

When running the tests now, only the following tests fail:
NHibernate.Search.Tests.Shards.ShardsTest.StandardBehavior with a
System.IO.DirectoryNotFoundException (cannot find indextemp directory)
NHibernate.Search.Tests.Shards.ShardsTest.InternalSharding with
NHibernate.PersistentObjectException : detached entity passed to
persist: NHibernate.Search.Tests.Shards.Animal

Are these critical tests? Will I be fine ignoring these tests?

If so, can you create a branch that uses Lucene.NET 2.9.2, and apply
these changes?

Reply all
Reply to author
0 new messages