use of org.apache.lucene.benchmark.quality.utils.DocNameExtractor in project lucene-solr by apache.
the class QualityBenchmark method analyzeQueryResults.
/* Analyze/judge results for a single quality query; optionally log them. */
private QualityStats analyzeQueryResults(QualityQuery qq, Query q, TopDocs td, Judge judge, PrintWriter logger, long searchTime) throws IOException {
QualityStats stts = new QualityStats(judge.maxRecall(qq), searchTime);
ScoreDoc[] sd = td.scoreDocs;
// extraction of first doc name we measure also construction of doc name extractor, just in case.
long t1 = System.currentTimeMillis();
DocNameExtractor xt = new DocNameExtractor(docNameField);
for (int i = 0; i < sd.length; i++) {
String docName = xt.docName(searcher, sd[i].doc);
long docNameExtractTime = System.currentTimeMillis() - t1;
t1 = System.currentTimeMillis();
boolean isRelevant = judge.isRelevant(docName, qq);
stts.addResult(i + 1, isRelevant, docNameExtractTime);
}
if (logger != null) {
logger.println(qq.getQueryID() + " - " + q);
stts.log(qq.getQueryID() + " Stats:", 1, logger, " ");
}
return stts;
}
Aggregations