Trunk version of NH.Search produces Load (e.g. select .. where Id=X) for each result fetched in Lucene, which is bug. If you have possibility to rebuild NH.Search, just download NH.Search trunk and apply this patch: http://nhjira.koah.net/browse/NHSR-17 After that, NH.Search will fetch all results within single SQL statement (e.g. select ... where ID in (X,Y,Z)).
Jozef 2009/4/2 orjan <[email protected]> > > 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 */ > > > > > -- Jozef --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
