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

Rob Audenaerde commented on LUCENE-5476:
----------------------------------------

Hi all, good points.

Actually, in my app, I always to a count before any other search/facetting. 
This means I can set a sampling ratio to be appropriate for the number of 
results (or even decide not to do sampling at all). So for my application, I 
have enough functionality as-is in this issue.

But of course if would be nice if it could be implemented in one pass, because 
there are more people using Lucene :)
 
I think it would not be that hard to implement a lower-bound; if for example 
15.000 would be the minimum number of documents before sampling kicks in, the 
{{RandomSamplingFacetCollector}} could also collect docs in a int[15000] to 
make sure that if there are less hits, the int[] is used, else the sampled set. 
The exact-part collector can stop collecting after these 15k docs.

A bit harder is the upper-bound, as you only know how many hits there are after 
collecting them all. To prevent collecting all the documents, you need a 
sampling rate to start skipping documents. If the result then contains too much 
document; the sampled result can be re-sampled to the desired size. I think 
this is more like the previous implementation of the SamplingCollector.

I have already implemented a small test (and fixed an off-by-one using it) ; I 
will create a patch today that contains this test and the {{xorshift}} merged 
back into the collector.  

Is it a good idea to explore this upper-bound/lower-bound approach? Maybe you 
already thought of alternative approaches as well?
  


> 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, LUCENE-5476.patch, 
> LUCENE-5476.patch, SamplingComparison_SamplingFacetsCollector.java, 
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to