I'm trying to implement a text search option using the Lucene-based full-text search engine on my NHibernate-based MVC project (NHibernate.Search). All the documentation I've seen on how to do this suggests I need to look at specific columns for values, something like:
var query = "Title:Ford";
using (var search = NHibernate.Search.Search.CreateFullTextSession(s))
{
using (var transaction = s.BeginTransaction())
{
var carSearchResults = search.CreateFullTextQuery(query)
.SetMaxResults(5)
.List();
foreach(var car in carSearchResults)
{
Console.WriteLine(car.Title);
}
transaction.Commit();
}
}
I would rather look at all full-text indexed columns for the search string, like you can do in SQL with a wildcard on the FREETEXT
function... so I could do something like:
var query = "Ford";
using (var search = NHibernate.Search.Search.CreateFullTextSession(s))
{
using (var transaction = s.BeginTransaction())
{
var carSearchResults = search.CreateFullTextQuery(query)
.SetMaxResults(5)
.List();
foreach(var car in carSearchResults)
{
Console.WriteLine(car.Title);
}
transaction.Commit();
}
}
... and this would examine all full-text indexed properties for "Ford", and return all hits. Is there a comparable function/ method/ syntax for this using the NHibernate-based search engine?