Hi, I'm working with Cyril on this project. The aim is to develop a search engine that can sort the results by relevance. Some of the relevance rules cannot be calculated by the database (I cannot explain precisely why without explaining all the project, so please believe me ;-) ).
So, we have to make a first HQL query that returns only the results, but not sorted. Then, we must browse each result to calculate its relevance. Then we sort. The last two steps are very fast, even with more than 100k records. So, there's no problem when the HQL query returns a small set of objetcs. But when there's a lot of results, the query is very slow, and mainly because of the data loading (as explained in the first post). So, to answer to Carlos : (1) We load only the results, but we load all of the results in one time (2) We calculate the relevance of each result (3) We sort the results by relevance. The real problem is that we cannot paginate the results by the DB because we have to calculate the relevance of each record in memory. So we must load all of them in one time. We'll try a Stateless session as Fabio said. Thank you. On 6 août, 17:25, Carlos cubas <[email protected]> wrote: > Let me understand this clearly.... > > (1) You Load All records > (2) You Search over loaded records > (3) Then Filter > > Sounds to me like a backwards approach.... > > I would do the opposite > > (1) Filter on DB > (2) Search on Filtered > (3) Load records > > -Carlos > > Practice makes perfect, but if no one is perfect, why practice? > > Date: Thu, 6 Aug 2009 16:17:20 +0200 > Subject: [nhusers] Re: Faster loading of a lot of records to a collection > (100 000 records) > From: [email protected] > To: [email protected] > > On Thu, Aug 6, 2009 at 3:50 PM, Paco Wensveen <[email protected]> wrote: > > Why do you want to load so many records at once? > I load all records from my database for search and calculate relevance > according to some informations. > > Why do you want to use NHibernate instead of plane old sql? > > I'm trying to use plane old sql, but my objects don't be linked to my > Nhibernate session. > -- > Cordialement, > > Cyril GRAUFFEL --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" 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/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
