How to use 2nd Level Cache with NHibernate.Search ?
I tried to enable SetCacheable on FullTextQuery, but it doesn't work.
var session = Search.CreateFullTextSession(database.Session);
session.CacheMode = CacheMode.Normal;
var textQuery = session.CreateFullTextQuery(query, new[] { typeof(Job) });
textQuery.SetCacheable(true);
textQuery.SetCacheRegion("Job");
var jobs = textQuery.List<Job>();
return jobs;
For all other standard queries tha cache works well but with FullTextQueries, it doesn't, NHibernate.Search still hit my database.
Note that NHibernate.Search produced queries are SELECT ... WHERE EntityId IN (Id1,Id2,Id3,...)