for (int i = 0; i < hits.scoreDocs.length; i++)
{
int docid = hits.scoreDocs[i].doc;
float score = hits.scoreDocs[i].score;
Explanation exp = searcher.explain(q, docid);
Document doc = reader.document(docid);
long uid = reader.getUID(docid);
docs = docs + "UID: " + formatter.format(uid) + "\ndocid(in reader): " + formatter.format(docid) + "\nscore: " + score + "\n\n";
docstr = docstr + "UID: " + formatter.format(uid) + "\ndocid(in reader): " + formatter.format(docid) + "\nscore: " + score + "\n" + doc + "\n" + exp + "\n\n";
}
retstr += hits.totalHits + " hits returned\n" + docs + "\n";