use of org.apache.lucene.search.similarities.Similarity in project lucene-solr by apache.
the class TestDFRSimilarityFactory method testParameters.
/** dfr with parametrized normalization */
public void testParameters() throws Exception {
Similarity sim = getSimilarity("text_params");
assertEquals(DFRSimilarity.class, sim.getClass());
DFRSimilarity dfr = (DFRSimilarity) sim;
assertEquals(BasicModelIF.class, dfr.getBasicModel().getClass());
assertEquals(AfterEffectB.class, dfr.getAfterEffect().getClass());
assertEquals(NormalizationH3.class, dfr.getNormalization().getClass());
NormalizationH3 norm = (NormalizationH3) dfr.getNormalization();
assertEquals(900f, norm.getMu(), 0.01f);
}
use of org.apache.lucene.search.similarities.Similarity in project lucene-solr by apache.
the class TestIBSimilarityFactory method testParameters.
/** ll/ttf/h3 with parametrized normalization */
public void testParameters() throws Exception {
Similarity sim = getSimilarity("text_params");
assertEquals(IBSimilarity.class, sim.getClass());
IBSimilarity ib = (IBSimilarity) sim;
assertEquals(DistributionLL.class, ib.getDistribution().getClass());
assertEquals(LambdaTTF.class, ib.getLambda().getClass());
assertEquals(NormalizationH3.class, ib.getNormalization().getClass());
NormalizationH3 norm = (NormalizationH3) ib.getNormalization();
assertEquals(900f, norm.getMu(), 0.01f);
}
use of org.apache.lucene.search.similarities.Similarity in project lucene-solr by apache.
the class TestLMJelinekMercerSimilarityFactory method testParameters.
/** jelinek-mercer with parameters */
public void testParameters() throws Exception {
Similarity sim = getSimilarity("text_params");
assertEquals(LMJelinekMercerSimilarity.class, sim.getClass());
LMJelinekMercerSimilarity lm = (LMJelinekMercerSimilarity) sim;
assertEquals(0.4f, lm.getLambda(), 0.01f);
}
use of org.apache.lucene.search.similarities.Similarity in project lucene-solr by apache.
the class TestPerFieldSimilarity method testFactoryDynamic.
/** ... and for a dynamic field */
public void testFactoryDynamic() throws Exception {
Similarity sim = getSimilarity("text_sim2");
assertEquals(MockConfigurableSimilarity.class, sim.getClass());
assertEquals("is there an echo?", ((MockConfigurableSimilarity) sim).getPassthrough());
}
use of org.apache.lucene.search.similarities.Similarity in project lucene-solr by apache.
the class TestBM25SimilarityFactory method testParameters.
/** bm25 with parameters */
public void testParameters() throws Exception {
Similarity sim = getSimilarity("text_params");
assertEquals(BM25Similarity.class, sim.getClass());
BM25Similarity bm25 = (BM25Similarity) sim;
assertEquals(1.2f, bm25.getK1(), 0.01f);
assertEquals(0.76f, bm25.getB(), 0.01f);
}
Aggregations