use of org.apache.lucene.queries.function.valuesource.NormValueSource in project lucene-solr by apache.
the class TestValueSources method testNorm.
public void testNorm() throws Exception {
Similarity saved = searcher.getSimilarity(true);
try {
// no norm field (so agnostic to indexed similarity)
searcher.setSimilarity(new ClassicSimilarity());
ValueSource vs = new NormValueSource("byte");
assertHits(new FunctionQuery(vs), new float[] { 1f, 1f });
// regardless of whether norms exist, value source exists == 0
assertAllExist(vs);
vs = new NormValueSource("text");
assertAllExist(vs);
} finally {
searcher.setSimilarity(saved);
}
}
use of org.apache.lucene.queries.function.valuesource.NormValueSource in project lucene-solr by apache.
the class TestLongNormValueSource method testNorm.
public void testNorm() throws Exception {
Similarity saved = searcher.getSimilarity(true);
try {
// no norm field (so agnostic to indexed similarity)
searcher.setSimilarity(sim);
assertHits(new FunctionQuery(new NormValueSource("text")), new float[] { 0f, 0f });
} finally {
searcher.setSimilarity(saved);
}
}
Aggregations