final Query query = npq("renaud", "delbru").getLuceneProxyQuery();
final Weight w = query.createWeight(searcher);
// Explain entity 0 : 1 match
Explanation explanation = w.explain((AtomicReaderContext) reader.getContext(), 0);
assertNotNull("explanation is null and it shouldn't be", explanation);
// final Similarity sim = searcher.getSimilarity();
// TODO: The similarity is randomly set
// System.out.println("Explanation: " + explanation.toString());
// //All this Explain does is return the term frequency
// assertEquals("term frq is not 1",
// sim.tf(1), explanation.getDetails()[1].getDetails()[0].getValue(), 0.01);
// Explain entity 1 : 2 match
explanation = w.explain((AtomicReaderContext) reader.getContext(), 1);
assertNotNull("explanation is null and it shouldn't be", explanation);
// TODO: The similarity is randomly set
// System.out.println("Explanation: " + explanation.toString());
// //All this Explain does is return the term frequency
// assertEquals("term frq is not 2",
// sim.tf(2), explanation.getDetails()[1].getDetails()[0].getValue(), 0f);
// Explain non existing entity
explanation = w.explain((AtomicReaderContext) reader.getContext(), 2);
assertNotNull("explanation is null and it shouldn't be", explanation);
// System.out.println("Explanation: " + explanation.toString());
//All this Explain does is return the term frequency
assertEquals("term frq is not 0", 0f, explanation.getValue(), 0f);
}