Generating a Lucene.NET Index 10. October 2009 Dave Knipper C#, Console, Lucene.NET (0) NHibernate.Search is an awesome search API, but it's poorly documented. Besides a few blog posts, I have not had much luck getting answers to my NHibernate.Search questions. I hope this article can help you avoid some headaches. This article assumes you have a working knowledge of NHibernate Search and Lucene.NET. If you’re looking for basics on NHibernate Search and Lucene.NET, just Google "NHibernate.Search" and/or "Lucene.NET" and you'll find what you're looking for. To work with this code, you will need to find some the NHibernate.Search and Lucene.Net DLLs. I had a hell of time finding the NHibernate.Search source code, so it's your lucky day! I added some support files here. They probably aren’t the last versions, but they work. NHibernate Search: 2009_10_NHibernateSearch.zip (2.6MB) The following console application generates a full lucene index based off an indexable NHibernate data abstraction layer. I wrote this utility to regenerate a lucene.net index for cases when my index and database get out of sync. This utility can be extremely helpful during initial development time when a lot of backdoor editing is happening to the database, and the application layer is not indexing the data when the database is being modified. Here’s an example of a class from an NHibernate data abstraction layer which represents a glossary term. It’s important to note that this class is decorated a “Indexed,” this attribute indicates that this type of entity is to be indexed into the lucene index. Once everything is initialized, the application loops through all the Types in the assembly’s exported types collection. If the current Type is decorated as "Indexed", all of the entities for that particular data entity class are added to the lucene index.