Class SamplingParams
- java.lang.Object
-
- org.apache.lucene.facet.search.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 Description static intDEFAULT_MAX_SAMPLE_SIZEDefault maximum size of sample.static intDEFAULT_MIN_SAMPLE_SIZEDefault minimum size of sample.static doubleDEFAULT_OVERSAMPLE_FACTORDefault factor by which more results are requested over the sample set.static doubleDEFAULT_SAMPLE_RATIODefault ratio between size of sample to original size of document set.static intDEFAULT_SAMPLING_THRESHOLDDefault sampling threshold, if number of results is less than this number - no sampling will take place
-
Constructor Summary
Constructors Constructor Description SamplingParams()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMaxSampleSize()Return the maxSampleSize.intgetMinSampleSize()Return the minSampleSize.doublegetOversampleFactor()Return the oversampleFactor.doublegetSampleRatio()intgetSamplingThreshold()Return the samplingThreshold.voidsetMaxSampleSize(int maxSampleSize)voidsetMinSampleSize(int minSampleSize)voidsetOversampleFactor(double oversampleFactor)voidsetSampingThreshold(int sampingThreshold)Set a sampling-thresholdvoidsetSampleRatio(double sampleRatio)booleanvalidate()Check validity of sampling settings, making sure thatminSampleSize <= maxSampleSize <= samplingThreshold0 < samplingRatio <= 1
-
-
-
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.
-
DEFAULT_MAX_SAMPLE_SIZE
public static final int DEFAULT_MAX_SAMPLE_SIZE
Default maximum size of sample.
-
DEFAULT_MIN_SAMPLE_SIZE
public static final int DEFAULT_MIN_SAMPLE_SIZE
Default minimum size of sample.
-
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
-
-
Method Detail
-
getMaxSampleSize
public final int getMaxSampleSize()
Return the maxSampleSize. In no case should the resulting sample size exceed this value.
-
getMinSampleSize
public final int getMinSampleSize()
Return the minSampleSize. In no case should the resulting sample size be smaller than this value.
-
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()
-
setSampingThreshold
public void setSampingThreshold(int sampingThreshold)
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 asTakmiSampleFixer. 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()
-
-