lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomislav Poljak <tpol...@gmail.com>
Subject Filter vs. TermQuery performance
Date Fri, 07 May 2010 18:34:46 GMT
Hi,
when is it wise to replace a TermQuery with cached Filter (regarding
search performance). If TermQuery is used only to filter results based
on field value (it doesn't participate in scoring), is it alway wise to
replace it with filter? Is it only wise if Filter is cached (wrapped in
CachingWrapperFilter) and reused often?


Does it matter how many distinct values field has (which is related to
how many matches/results for one given/selected value is returned and
also with how many times same filter instance is reused)?

For example, what if filter for single value matches only 5% of docs,
should filter be used or is it better to use TermQuery? 

What about if filter for single value matches 20%? or 50% or 75%

I have a question regarding caching performance/memory usage. Documents
have date&time indexed (as NumericField) with minute resolution and
there are few thousands unique date&time in index. On the search side
open ended range filter is used (NumericRangeFilter) with current time
as a parameter.

Now, is it wise to cache NumericRangeFilter here (reuse instance of
CachingWrapperFilter wrapping NumericRangeFilter) since it will not be
reused often (only from users searching at same time in same time zone)?

Is it better to use NumericRangeFilter or NumericRangeQuery in this
case?

Tomislav








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


Mime
View raw message