use of org.apache.lucene.queries.function.valuesource.TermFreqValueSource in project lucene-solr by apache.
the class TestValueSources method testTermFreq.
public void testTermFreq() throws Exception {
ValueSource vs = new TermFreqValueSource("bogus", "bogus", "text", new BytesRef("test"));
assertHits(new FunctionQuery(vs), new float[] { 3f, 1f });
assertAllExist(vs);
vs = new TermFreqValueSource("bogus", "bogus", "string", new BytesRef("bar"));
assertHits(new FunctionQuery(vs), new float[] { 0f, 1f });
assertAllExist(vs);
// regardless of whether norms exist, value source exists == 0
vs = new TermFreqValueSource("bogus", "bogus", "bogus", new BytesRef("bogus"));
assertHits(new FunctionQuery(vs), new float[] { 0F, 0F });
assertAllExist(vs);
}
Aggregations