org.apache.lucene.facet.sampling

## Class SamplingParams

- java.lang.Object
- - org.apache.lucene.facet.sampling.SamplingParams

-     public class SamplingParams
      extends Object

  Parameters for sampling, dictating whether sampling is to take place and how.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_MAX_SAMPLE_SIZE` Default maximum size of sample.
    `static int` | `DEFAULT_MIN_SAMPLE_SIZE` Default minimum size of sample.
    `static double` | `DEFAULT_OVERSAMPLE_FACTOR` Default factor by which more results are requested over the sample set.
    `static double` | `DEFAULT_SAMPLE_RATIO` Default ratio between size of sample to original size of document set.
    `static int` | `DEFAULT_SAMPLING_THRESHOLD` Default sampling threshold, if number of results is less than this number - no sampling will take place

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SamplingParams()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getMaxSampleSize()` Return the maxSampleSize.
    `int` | `getMinSampleSize()` Return the minSampleSize.
    `double` | `getOversampleFactor()` Return the oversampleFactor.
    `double` | `getSampleRatio()`
    `int` | `getSamplingThreshold()` Return the samplingThreshold.
    `void` | `setMaxSampleSize(int maxSampleSize)`
    `void` | `setMinSampleSize(int minSampleSize)`
    `void` | `setOversampleFactor(double oversampleFactor)`
    `void` | `setSampleRatio(double sampleRatio)`
    `void` | `setSamplingThreshold(int samplingThreshold)` Set a sampling-threshold
    `boolean` | `validate()` Check validity of sampling settings, making sure that `minSampleSize <= maxSampleSize <= samplingThreshold` `0 < samplingRatio <= 1`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_OVERSAMPLE_FACTOR

          public static final double DEFAULT_OVERSAMPLE_FACTOR

      Default factor by which more results are requested over the sample set.
      See Also:
        `getOversampleFactor()`, Constant Field Values

    - #### DEFAULT_SAMPLE_RATIO

          public static final double DEFAULT_SAMPLE_RATIO

      Default ratio between size of sample to original size of document set.
      See Also:
        `Sampler.getSampleSet(org.apache.lucene.facet.search.ScoredDocIDs)`, Constant Field Values

    - #### DEFAULT_MAX_SAMPLE_SIZE

          public static final int DEFAULT_MAX_SAMPLE_SIZE

      Default maximum size of sample.
      See Also:
        `Sampler.getSampleSet(org.apache.lucene.facet.search.ScoredDocIDs)`, Constant Field Values

    - #### DEFAULT_MIN_SAMPLE_SIZE

          public static final int DEFAULT_MIN_SAMPLE_SIZE

      Default minimum size of sample.
      See Also:
        `Sampler.getSampleSet(org.apache.lucene.facet.search.ScoredDocIDs)`, Constant Field Values

    - #### DEFAULT_SAMPLING_THRESHOLD

          public static final int DEFAULT_SAMPLING_THRESHOLD

      Default sampling threshold, if number of results is less than this number - no sampling will take place
      See Also:
        `getSampleRatio()`, Constant Field Values

  - ### Constructor Detail

    - #### SamplingParams

          public SamplingParams()

  - ### Method Detail

    - #### getMaxSampleSize

          public final int getMaxSampleSize()

      Return the maxSampleSize. In no case should the resulting sample size exceed this value.
      See Also:
        `Sampler.getSampleSet(org.apache.lucene.facet.search.ScoredDocIDs)`

    - #### getMinSampleSize

          public final int getMinSampleSize()

      Return the minSampleSize. In no case should the resulting sample size be smaller than this value.
      See Also:
        `Sampler.getSampleSet(org.apache.lucene.facet.search.ScoredDocIDs)`

    - #### getSampleRatio

          public final double getSampleRatio()

      Returns:
        the sampleRatio
      See Also:
        `Sampler.getSampleSet(org.apache.lucene.facet.search.ScoredDocIDs)`

    - #### getSamplingThreshold

          public final int getSamplingThreshold()

      Return the samplingThreshold. Sampling would be performed only for document sets larger than this.

    - #### setMaxSampleSize

          public void setMaxSampleSize(int maxSampleSize)

      Parameters:
        `maxSampleSize` - the maxSampleSize to set
      See Also:
        `getMaxSampleSize()`

    - #### setMinSampleSize

          public void setMinSampleSize(int minSampleSize)

      Parameters:
        `minSampleSize` - the minSampleSize to set
      See Also:
        `getMinSampleSize()`

    - #### setSampleRatio

          public void setSampleRatio(double sampleRatio)

      Parameters:
        `sampleRatio` - the sampleRatio to set
      See Also:
        `getSampleRatio()`

    - #### setSamplingThreshold

          public void setSamplingThreshold(int samplingThreshold)

      Set a sampling-threshold
      See Also:
        `getSamplingThreshold()`

    - #### validate

          public boolean validate()

      Check validity of sampling settings, making sure that
      - `minSampleSize <= maxSampleSize <= samplingThreshold`
      - `0 < samplingRatio <= 1`
      Returns:
        true if valid, false otherwise

    - #### getOversampleFactor

          public final double getOversampleFactor()

      Return the oversampleFactor. When sampling, we would collect that much more results, so that later, when selecting top out of these, chances are higher to get actual best results. Note that having this value larger than 1 only makes sense when using a SampleFixer which finds accurate results, such as `TakmiSampleFixer`. When this value is smaller than 1, it is ignored and no oversampling takes place.

    - #### setOversampleFactor

          public void setOversampleFactor(double oversampleFactor)

      Parameters:
        `oversampleFactor` - the oversampleFactor to set
      See Also:
        `getOversampleFactor()`

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.