I have a small problem with NHSearch where a simple fulltext search
resulting in N+1 DB calls
public IList<Log> FulltextSearch(string queryString)
{
IFullTextSession s =
NHibernate.Search.Search.CreateFullTextSession
(NHibernateSession.Current);
ITransaction tx = s.BeginTransaction();
Analyzer analyzer = new SimpleAnalyzer();
var parser = new MultiFieldQueryParser(
new[] {"Message", "Exception"},
analyzer);
Query query = parser.Parse(queryString);
IQuery hibQuery = s.CreateFullTextQuery(query, typeof
(Log));
IList<Log> logs = hibQuery.List<Log>();
tx.Commit();
return logs;
}
Resulting in N queries like this one according to NHprofiler:
SELECT log0_.Id as Id0_0_,
log0_.UserName as UserName0_0_,
log0_.Machine as Machine0_0_,
log0_.IP as IP0_0_,
log0_.Date as Date0_0_,
log0_.Exception as Exception0_0_,
log0_.Installation as Installa7_0_0_,
log0_.Logger as Logger0_0_,
log0_.Level as Level0_0_,
log0_.Thread as Thread0_0_,
log0_.UrlReferrer as UrlRefe11_0_0_,
log0_.Url as Url0_0_,
log0_.Message as Message0_0_
FROM Logs log0_
WHERE log0_.Id = 68 /* @p0 */
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"NHibernate Contrib - Development Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com.ar/group/nhcdevs?hl=en
-~----------~----~----~----~------~----~------~--~---