Module org.elasticsearch.server
Class RandomSamplingQuery
java.lang.Object
org.apache.lucene.search.Query
org.elasticsearch.search.aggregations.bucket.sampler.random.RandomSamplingQuery
public final class RandomSamplingQuery
extends org.apache.lucene.search.Query
A query that randomly matches documents with a user-provided probability within a geometric distribution
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.lucene.search.Weight
createWeight
(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.ScoreMode scoreMode, float boost) boolean
int
hashCode()
void
visit
(org.apache.lucene.search.QueryVisitor visitor) Methods inherited from class org.apache.lucene.search.Query
classHash, rewrite, rewrite, sameClassAs, toString
-
Constructor Details
-
RandomSamplingQuery
public RandomSamplingQuery(double p, int seed, int hash) - Parameters:
p
- The sampling probability e.g. 0.05 == 5% probability a document will matchseed
- The seed from the builderhash
- A unique hash so that if the same seed is used between multiple queries, unique random number streams can be generated
-
-
Method Details
-
toString
- Specified by:
toString
in classorg.apache.lucene.search.Query
-
createWeight
public org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.ScoreMode scoreMode, float boost) throws IOException - Overrides:
createWeight
in classorg.apache.lucene.search.Query
- Throws:
IOException
-
visit
public void visit(org.apache.lucene.search.QueryVisitor visitor) - Specified by:
visit
in classorg.apache.lucene.search.Query
-
equals
- Specified by:
equals
in classorg.apache.lucene.search.Query
-
hashCode
public int hashCode()- Specified by:
hashCode
in classorg.apache.lucene.search.Query
-