-->
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.  [ 2 posts ] 
Author Message
 Post subject: Get un-attached results / save round trip
PostPosted: Fri Jan 25, 2013 8:53 am 
Newbie

Joined: Thu Jan 24, 2013 4:45 pm
Posts: 1
I just want to search the index and get information out of it without going to the database. The objects I use can be very large so it is much better to figure out the exact instance I need to retrieve before going to the database. Projections are not ideal because they return object[] ideally hibernate search would return un-managed instance objects with all available information filled in. I am coming from compass search which is a dead project now but that was the default behavior and worked quite well.

Please advise if there is anyway to achieve this behavior.


Top
 Profile  
 
 Post subject: Re: Get un-attached results / save round trip
PostPosted: Sat Jan 26, 2013 6:33 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
it could be done, but generally I see some problems with it:
- the API should make it very clear that these are unmanaged and detached entities:
* they are out of transactions
* navigating lazy loaded properties is not going to work
* changes made to these objects will not be synchronised back to the index nor to the database
- we only store in the index the minimal set of fields required, as mapped explicitly by the user
* we won't be able to load any field not mapped as @Field & Stored.YES
* Making extended use of Stored.YES is not to be advised: it bloats the index making it larger than needed and slower
- extracting fields from Stored fields is performance intensive: usually a database can do better than that, especially with 2nd level cache

I would advise to make a constructor for your entities which takes the Object[] returned from a projection: that is not too different than what we would have to do, but at least you do it explicitly and are aware of the limitations.
I suspect that you could address them better than with a general purpose solution, but you're very welcome to provide suggestions.

Usually what people do on very performance sensitive areas is to use combine it with a 2nd level cache: nothing beats the performance of a map lookup;
you can combine fulltext queries with 2nd level cache interaction by using ObjectLookupMethod as described in chapter:
5.1.3.6. Customizing object initialization strategies

http://docs.jboss.org/hibernate/search/4.2/reference/en-US/html_single/

Please le me know how it goes, it would be interesting to explore new strategies if needed.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.