## 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
`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
`SamplingParams()`

Method Summary
`int` `getMaxSampleSize()` Return the maxSampleSize.
`int` `getMinSampleSize()` Return the minSampleSize.
`double` `getOversampleFactor()` Return the oversampleFactor.
`SampleFixer` `getSampleFixer()`
`double` `getSampleRatio()`
`int` `getSamplingThreshold()` Return the samplingThreshold.
`void` `setMaxSampleSize(int maxSampleSize)`
`void` `setMinSampleSize(int minSampleSize)`
`void` `setOversampleFactor(double oversampleFactor)`
`void` `setSampleFixer(SampleFixer sampleFixer)` Set a `SampleFixer` to be used while fixing the sampled results.
`void` `setSampleRatio(double sampleRatio)`
`void` `setSamplingThreshold(int samplingThreshold)` Set a sampling-threshold
`boolean` `shouldOverSample()` Returns whether over-sampling should be done.
`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()`

### getSampleFixer

    public SampleFixer getSampleFixer()

  Returns:
    `SampleFixer` to be used while fixing the sampled results, if `null` no fixing will be performed

### setSampleFixer

    public void setSampleFixer(SampleFixer sampleFixer)

  Set a `SampleFixer` to be used while fixing the sampled results. `null` means no fixing will be performed

### shouldOverSample

    public boolean shouldOverSample()

  Returns whether over-sampling should be done. By default returns `true` when `getSampleFixer()` is not `null` and `getOversampleFactor()` > 1, `false` otherwise.

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