-->
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: Caching of Lucene search results?
PostPosted: Wed Sep 14, 2011 2:00 am 
Newbie

Joined: Mon Apr 11, 2011 1:54 am
Posts: 5
Hi,

(A) Can Hibernate Search cache search results?
Like, "iphone" is a popular product, so many users repeat the query "+product:iphone +manufacturer:apple" (query through a FullTextSession)...
It could be cached, if we assume all Lucene updates go through Hibernate-Search (so it knows when to invalidate the cache).

(B) A related question, does Hibernate Search assume that no other process touches the Lucene Index?
Because I have an old home-made process that updates both the database and Lucene (keeping them consistent).
Can it run "side by side" with a newer Hibernate-Search based system? Of course disabling the 2nd level cache?

I was thinking, in the 1st stages my Hibernate-Search application may run alongside the old system, so I'd like to make sure its possible (with caching disabled).
When we get rid of the old system, I'd be glad to have a cache (in hibernate-core, and also in hibernate-search if possible).

Thank you.


Top
 Profile  
 
 Post subject: Re: Caching of Lucene search results?
PostPosted: Wed Sep 14, 2011 2:49 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
(A) Can Hibernate Search cache search results?
Like, "iphone" is a popular product, so many users repeat the query "+product:iphone +manufacturer:apple" (query through a FullTextSession)...
It could be cached, if we assume all Lucene updates go through Hibernate-Search (so it knows when to invalidate the cache).


Yes, in several ways. The IndexReaders are reopened and keep the buffers of previous searches around even when opening a new IndexReader to be able to see fresh data, so if you repeat the same query the second time it will be much faster as the results are not directly cached but all other needed structures are.
It is also able to use the Hibernate Second level cache to load the entity values which are identified from the fulltext query (not cached directly).

In addition you can use filters, like in your example you could have a "manufacturer" filter and a "product" filter, both having a parameter which is going to be a key for the filter. Filters can be cached with several strategies, and this can of course be combined with the previously mentioned caches.

Quote:
(B) A related question, does Hibernate Search assume that no other process touches the Lucene Index?
Because I have an old home-made process that updates both the database and Lucene (keeping them consistent).
Can it run "side by side" with a newer Hibernate-Search based system? Of course disabling the 2nd level cache?

Yes that's possible. As you say you would need to disable second-level cache, and also you'll have to make sure the exclusive_index_use option is set to false.
When configuring it this way you'll be losing some of the performance benefits from the features I listed on A).

If you use Hibernate Search 4 all these options can be set differently on each index.

_________________
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.