lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Uwe Schindler <...@thetaphi.de>
Subject Re: CachingWrapperFilter use
Date Sat, 08 Jan 2011 02:44:46 GMT
That's exactly how its intended to work!

Uwe



"entdeveloper" <cameron.developer@gmail.com> schrieb:

>
>Oook. So I think I figured this out: the CachingWrapperFilter isn't
>really
>intended to be used dynamically (i.e. the wrapped filter changes for
>each
>search). It's only really useful if the same filter is being used every
>time
>(e.g. filter type=movies for a movie search site).
>
>Am I getting that right?
>
>I guess what I need is something like Solr's filter cache, where
>filters
>based on repeated search criteria are retrieved from the cache. Has
>anyone
>written something like this and used filters in this way before?
>
>I have a search where one of the criteria is a location (New York, Los
>Angeles, Chicago). I want to put this term in a filter, so that every
>subsequent request for one of those locations is pulled from a cache
>for
>better performance.
>
>
>entdeveloper wrote:
>> 
>> How is the CachingWrapperFilter intended to be used in a web
>environment
>> where new requests come in to be executed? Each time a search comes
>in, I
>> create a filter and then wrap it with a new instance of the
>> CachingWrapperFilter (to cache searches when requests for the same
>input
>> comes in) like so:
>> 
>> TopDocs search(String input) {
>>   Term term = new Term("name", input);
>>   Filter filter = new CachingWrapperFilter(new PrefixFilter(term));
>> 
>>   return indexSearcher.search(new MatchAllDocsQuery(), filter, 10,
>null);
>> }
>> 
>> So if my understanding is correct, given the javadoc and example in
>> 'Lucene in Action', this won't actually cache anything because each
>time a
>> new request comes in, a new instance of CachingWrapperFilter is being
>> used. I'm a little confused as to how CachingWrapperFilter is to be
>used
>> otherwise. Can anyone help?
>> 
>
>-- 
>View this message in context:
>http://lucene.472066.n3.nabble.com/CachingWrapperFilter-use-tp2209175p2215038.html
>Sent from the Lucene - General mailing list archive at Nabble.com.

--
Uwe Schindler
H.-H.-Meier-Allee 63, 28213 Bremen
http://www.thetaphi.de

Mime
View raw message