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…
- Install the NHibernate Search package the to
Eg.Coreproject using NuGet Package Manager Console by running the following command:Install-Package NHibernate.Search - In the
Entitybase class, decorate theIdproperty with the[DocumentId]attribute fromNHibernate.Search.Attributes. - Add the following attributes to the
Productclass:[Indexed] public class Product : Entity { [Field] public virtual string Name { get; set; } [Field...