lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yiqing Jin (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-855) MemoryCachedRangeFilter to boost performance of Range queries
Date Thu, 12 Apr 2007 08:02:32 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488291
] 

Yiqing Jin commented on LUCENE-855:
-----------------------------------

Hi, Matt
As i tried the FieldCacheRangeFilter i have got problem.

I added a test block at the end of TestFieldCacheRangeFilter

        FieldCacheRangeFilter f1 =  new FieldCacheRangeFilter("id", (float)minIP, (float)maxIP,
T, F);
        FieldCacheRangeFilter f2 =  new FieldCacheRangeFilter("id", (float)minIP, (float)maxIP,
F, T);
      
        ChainedFilter f = new ChainedFilter(new Filter[]{f1,f2},ChainedFilter.AND);
        result = search.search(q, f);
        assertEquals("all but ends", numDocs-2, result.length());

This could not pass and in fact the result.length() is 0; Nothing could be found. 


I checked my code and traced the running but still can't get result expected. It seems the
Filter won't work with the ChainedFilter. 
after the doChain the BitSet seems to be empty.(Either 'and' or 'or' operation). 
CODE:
[
case AND:
            	BitSet bit = filter.bits(reader);
                result.and(bit);
]
The bit is already empty before it's added to the result.


> MemoryCachedRangeFilter to boost performance of Range queries
> -------------------------------------------------------------
>
>                 Key: LUCENE-855
>                 URL: https://issues.apache.org/jira/browse/LUCENE-855
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: 2.1
>            Reporter: Andy Liu
>         Assigned To: Otis Gospodnetic
>         Attachments: contrib-filters.tar.gz, FieldCacheRangeFilter.patch, FieldCacheRangeFilter.patch,
FieldCacheRangeFilter.patch, FieldCacheRangeFilter.patch, FieldCacheRangeFilter.patch, MemoryCachedRangeFilter.patch,
MemoryCachedRangeFilter_1.4.patch, TestRangeFilterPerformanceComparison.java, TestRangeFilterPerformanceComparison.java
>
>
> Currently RangeFilter uses TermEnum and TermDocs to find documents that fall within the
specified range.  This requires iterating through every single term in the index and can get
rather slow for large document sets.
> MemoryCachedRangeFilter reads all <docId, value> pairs of a given field, sorts
by value, and stores in a SortedFieldCache.  During bits(), binary searches are used to find
the start and end indices of the lower and upper bound values.  The BitSet is populated by
all the docId values that fall in between the start and end indices.
> TestMemoryCachedRangeFilterPerformance creates a 100K RAMDirectory-backed index with
random date values within a 5 year range.  Executing bits() 1000 times on standard RangeQuery
using random date intervals took 63904ms.  Using MemoryCachedRangeFilter, it took 876ms. 
Performance increase is less dramatic when you have less unique terms in a field or using
less number of documents.
> Currently MemoryCachedRangeFilter only works with numeric values (values are stored in
a long[] array) but it can be easily changed to support Strings.  A side "benefit" of storing
the values are stored as longs, is that there's no longer the need to make the values lexographically
comparable, i.e. padding numeric values with zeros.
> The downside of using MemoryCachedRangeFilter is there's a fairly significant memory
requirement.  So it's designed to be used in situations where range filter performance is
critical and memory consumption is not an issue.  The memory requirements are: (sizeof(int)
+ sizeof(long)) * numDocs.  
> MemoryCachedRangeFilter also requires a warmup step which can take a while to run in
large datasets (it took 40s to run on a 3M document corpus).  Warmup can be called explicitly
or is automatically called the first time MemoryCachedRangeFilter is applied using a given
field.
> So in summery, MemoryCachedRangeFilter can be useful when:
> - Performance is critical
> - Memory is not an issue
> - Field contains many unique numeric values
> - Index contains large amount of documents

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message