-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Database Access vs Index
PostPosted: Wed Sep 08, 2010 10:07 am 
Newbie

Joined: Wed Sep 08, 2010 9:58 am
Posts: 6
Location: Sao Paulo | Brazil
Hi there!

I have a simple doubt about "when" the Hibernate Search "must" access the database.

For instance,

Here I prepare the query:
Code:
FullTextSession LuceneSession = Search.createFullTextSession(hibernateSession);
FullTextQuery fullTextQuery = LuceneSession.createFullTextQuery(LuceneQuery);


And here I get the result:
Code:
List myResult = fullTextQuery.list();


When the Hibernate Search returns the result, it must access the database to bring some other attributes of the entity or is there a way to avoid this (indexing them, for example)?

Thank you very much,
Rondon


Top
 Profile  
 
 Post subject: Re: Database Access vs Index
PostPosted: Thu Sep 09, 2010 2:10 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Hi there

You may want to consider using projections. You can store the data that you need in the index and then use it from the index without hitting the database. Please refer to the online Hibernate Search documentation on projections.

Hope that helps


Top
 Profile  
 
 Post subject: Re: Database Access vs Index
PostPosted: Thu Sep 09, 2010 9:45 pm 
Newbie

Joined: Wed Sep 08, 2010 9:58 am
Posts: 6
Location: Sao Paulo | Brazil
Hi Amin Mc,

That is exactily what I was looking for, thank you very much!

Best regards,
Rondon


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.