ScoreDoc sd[] = td.scoreDocs;
for (int i=0; i<sd.length; i++) {
float score = sd[i].score;
String id = s.getIndexReader().document(sd[i].doc).get(ID_FIELD);
log("-------- "+i+". Explain doc "+id);
log(s.explain(q,sd[i].doc));
float expectedScore = N_DOCS-i;
assertEquals("score of result "+i+" shuould be "+expectedScore+" != "+score, expectedScore, score, TEST_SCORE_TOLERANCE_DELTA);
String expectedId = inOrder
? id2String(N_DOCS-i) // in-order ==> larger values first
: id2String(i+1); // reverse ==> smaller values first