use of org.apache.lucene.queries.function.valuesource.MinFloatFunction in project lucene-solr by apache.
the class TestValueSources method testMinFloat.
public void testMinFloat() throws Exception {
ValueSource vs = new MinFloatFunction(new ValueSource[] { new ConstValueSource(1f), new ConstValueSource(2f) });
assertHits(new FunctionQuery(vs), new float[] { 1f, 1f });
assertAllExist(vs);
// as long as one value exists, then min exists
vs = new MinFloatFunction(new ValueSource[] { BOGUS_FLOAT_VS, new ConstValueSource(2F) });
assertHits(new FunctionQuery(vs), new float[] { 2F, 2F });
assertAllExist(vs);
vs = new MinFloatFunction(new ValueSource[] { BOGUS_FLOAT_VS, new ConstValueSource(2F), BOGUS_DOUBLE_VS });
assertAllExist(vs);
// if none exist, then min doesn't exist
vs = new MinFloatFunction(new ValueSource[] { BOGUS_FLOAT_VS, BOGUS_INT_VS, BOGUS_DOUBLE_VS });
assertNoneExist(vs);
}
Aggregations