You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2008/08/06 23:21:42 UTC

Re: Re-Search Hits

: for performance reasons I cache Hits for a certain Query in memcached, for
: things like pageination etc. My question right now is if it is possible to
: re-search such a cached Hits sets. That would be great for features like
: live-learch and so on. Does Lucene support that?

You can hang on to a Hits object as long as you want -- provided you don't 
close the search that created it -- but i really doubt caching it in 
something like memcached is going to work the way you expect, Hits 
instances keep a refrence to the IndexSearcher that created them so they 
can fetch additional documents as needed ... you will most likely 
encounter strange errors if you do this.

it's typically "fast enough" to just reissue the search, and if it's not 
then you need a better data structure to put in yourcache then Hits -- one 
that you very explicitly populate with however much data you expect to 
need.  (think of Hits like an Iterator that pre-fetches and internally 
caches some of the items it needs, but if you exhaust those first few 
items, the Iterator needs to keep getting the rest)


-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org