[ 
https://issues.apache.org/jira/browse/LUCENE-5476?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rob Audenaerde updated LUCENE-5476:
-----------------------------------

    Attachment: LUCENE-5476.patch

Here is a patch. 

I'm not totally satisfied with it though. There are two loose ends:

* When a segment has many docids but very few hits, they might be skipped 
altogether. If this happens in many segments, the estimate gets more and more 
off
* When a segment is small, there might be a few hits that are never touched as 
the randomIndex in the 'bin-o-hits' is greater than the index of the hit.

Some small performance indicators:

Using an in memory index with 10M documents, retrieving 25% of them and using a 
samplingRatio of 0.001 (skipping the first call, average on the next three)

Exact:  184 ms.
Sampled: 67 ms.

Not the 10-fold increase I had hoped for, but significantly faster.

Btw. for my use case the two problems I described above are not a real issue. I 
do a global count anyway, and use this to determine if the facets need to be 
sampled or not. When they need to be sampled, I know for sure that there are 
enough hits to give a proper estimate. The price of counting and sampling is 
lower than the price of retrieving exact facets.  



> Facet sampling
> --------------
>
>                 Key: LUCENE-5476
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5476
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Rob Audenaerde
>         Attachments: LUCENE-5476.patch, LUCENE-5476.patch, 
> SamplingFacetsCollector.java
>
>
> With LUCENE-5339 facet sampling disappeared. 
> When trying to display facet counts on large datasets (>10M documents) 
> counting facets is rather expensive, as all the hits are collected and 
> processed. 
> Sampling greatly reduced this and thus provided a nice speedup. Could it be 
> brought back?



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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

Reply via email to