Setting up full-text searches

While many relational databases provide some mechanism for full-text searches, these databases are optimized for Online Transaction Processing (OLTP) type workloads. Full-text search engines, on the other hand, are designed specifically for text queries, and excel at them. In this recipe, we'll show you how to use NHibernate search and Lucene.Net to provide full-text search capabilities to your applications.

Getting ready

Complete the Eg.Core model and mappings from Chapter 1, The Configuration and Schema.

How to do it…

  1. Install the NHibernate Search package the to Eg.Core project using NuGet Package Manager Console by running the following command:
    Install-Package NHibernate.Search
    
  2. In the Entity base class, decorate the ...

Get NHibernate 4.x Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.