lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samt & sonders <kont...@samtundsonders.at>
Subject Re: Proper use of LRUQueryCache
Date Mon, 11 Jan 2016 07:58:37 GMT
Thank you Adrien, very much appreciated!!

Andreas
> Adrien Grand <mailto:jpountz@gmail.com>
> 9 January 2016 at 19:22
> Le ven. 8 janv. 2016 à 12:05, samt&  sonders<kontakt@samtundsonders.at>  a
> écrit :
>
>> It seems like a default QueryCache is already set for an IndexReader
>> acquired by the SearcherManager. Is there any information about the
>> default settings?
>>
>
> Query caching is indeed enabled by default since 5.4:
> https://issues.apache.org/jira/browse/LUCENE-6784.  The default cache is
> tiny (32MB), you might want to make it a bit larger, especially if your
> indices are large. For instance caching a single filter on an index that
> contains 1B documents could require up to 120MB of RAM (worst case).
>
> Beware to not make it too large however, memory is usually better spent on
> the filesystem cache than on a query cache.
>
>
>> And are there any requirements I have to meet for the cache to work
>> properly beside than having a BooleanQuery with
>> BooleanClause.Occur.FILTER clauses?
>>
>
> Everything below a ConstantScoreQuery, a FILTER and a MUST_NOT clauses is
> considered a filter. Additionally, if scores are not needed (for instance
> if you're not sorting on the score), then the whole query is considered a
> filter and could be cached.
>
> samt & sonders <mailto:kontakt@samtundsonders.at>
> 8 January 2016 at 18:04
> Hi Adrien,
>
> thanks for your response!
> It seems like a default QueryCache is already set for an IndexReader 
> acquired by the SearcherManager. Is there any information about the 
> default settings?
>
> And are there any requirements I have to meet for the cache to work 
> properly beside than having a BooleanQuery with 
> BooleanClause.Occur.FILTER clauses?
>
> Cheers,
> Andreas
>
>
>
> Adrien Grand <mailto:jpountz@gmail.com>
> 7 January 2016 at 20:50
> Hi Andreas,
>
> The easiest way is to use the query cache through
> IndexSearcher.setQueryCache. Then IndexSearcher will figure out by itself
> which filters are worth caching.
>
> Le jeu. 7 janv. 2016 à 13:30, samt & sonders <kontakt@samtundsonders.at> a
>
> samt & sonders <mailto:kontakt@samtundsonders.at>
> 7 January 2016 at 19:30
> Hi,
>
> I'm changing my code from using 
> CachingWrapperQuery/CachingWrapperFilter to LRUQueryCache and I'm 
> running into some questions:
>
> 1.) what is the right way to use the LRUQueryCache:
>
> Query myCacheQuery = queryCache.doCache(myQuery, defaultCachingPolicy);
>
> a.)   Doing this ones and re-use myCacheQuery
>
> b.)  Doing this every time (which means I always have to rebuild myQuery)
>
>
> 3.) Before I have created one CachingWrapperFilter for each Filter. Am 
> I now supposed to create one LRUQueryCache for all of my Filters 
> (which are now Queries) or can it still create one LRUQueryCache for 
> each Filter (does it make sense?)
>
>
> Thanks for any help,
> Andreas
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
> ------------------------------------------------------------------------


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message