Class RandomSamplingFacetsCollector

    • Constructor Detail

      • RandomSamplingFacetsCollector

        public RandomSamplingFacetsCollector​(int sampleSize,
                                             long seed)
        Constructor with the given sample size and seed.
        Parameters:
        sampleSize - The preferred sample size. If the number of hits is greater than the size, sampling will be done using a sample ratio of sampling size / totalN. For example: 1000 hits, sample size = 10 results in samplingRatio of 0.01. If the number of hits is lower, no sampling is done at all
        seed - The random seed. If 0 then a seed will be chosen for you.
    • Method Detail

      • getMatchingDocs

        public List<FacetsCollector.MatchingDocs> getMatchingDocs()
        Returns the sampled list of the matching documents. Note that a FacetsCollector.MatchingDocs instance is returned per segment, even if no hits from that segment are included in the sampled set.

        Note: One or more of the MatchingDocs might be empty (not containing any hits) as result of sampling.

        Note: MatchingDocs.totalHits is copied from the original MatchingDocs, scores is set to null

        Overrides:
        getMatchingDocs in class FacetsCollector
      • getSamplingRate

        public double getSamplingRate()
        Returns the sampling rate that was used.