セットアップのEventListenerのためには、あなたはNHibernateはを初期化するときにこのコードを追加する必要があります。
NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();
//Load configuration
//Add NHibernate.Search listeners
cfg.SetListener(NHibernate.Event.ListenerType.PostUpdate, new FullTextIndexEventListener());
cfg.SetListener(NHibernate.Event.ListenerType.PostInsert, new FullTextIndexEventListener());
cfg.SetListener(NHibernate.Event.ListenerType.PostDelete, new FullTextIndexEventListener());
var factory = cfg.BuildSessionFactory();
があなたのweb.configファイル/ app.configファイルには、以下を含めるために変更する必要があります。
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" requirePermission="false"/>
<section name="nhs-configuration" type="NHibernate.Search.Cfg.ConfigurationSectionHandler, NHibernate.Search" requirePermission="false"/>
</configSections>
<!-- NHibernate.Search -->
<nhs-configuration xmlns='urn:nhs-configuration-1.0'>
<search-factory>
<property name='hibernate.search.default.directory_provider'>NHibernate.Search.Store.FSDirectoryProvider, NHibernate.Search</property>
<property name='hibernate.search.default.indexBase'>PATH TO LUCENE.NET STORE</property>
<property name='hibernate.search.indexing_strategy'>event</property>
</search-factory>
</nhs-configuration>
<appSettings>
<add key="Lucene.Net.lockdir" value="SAME PATH AS ABOVE" />
</appSettings>
...
最後に、ISessionインスタンスを作成するときは、代わりにこのコードを使用してIFullTextSessionを取得してください。
IFullTextSession session = Search.CreateFullTextSession(factory.OpenSession());
これは、Lucene 2.0とNHibernate 2.0で動作するはずです。
これは、この種の質問をする適切な場所ではないかもしれません - あなたはNHibernate contribグループhttp://groups.google.com/group/nhcdevs/を試しましたか? – Rashack