I'll apply the patch to trunk tonight - last few times I checked Jira was down
Paul ---------------------------------------- From: Jokin Cuadrado <[email protected]> Sent: 02 April 2009 13:36 To: [email protected] Subject: Re: N+1 problem with NHSearch would be very difficult to get a projection of the search results with proxys for the fields that are not in lucene? On Thu, Apr 2, 2009 at 2:27 PM, Jozef Sevcik wrote: > 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 >> >> I have a small problem with NHSearch where a simple fulltext search >> resulting in N+1 DB calls >> >> public IList 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 logs = hibQuery.List(); >> >> 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 > > > > -- Jokin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
