Example usage for org.apache.lucene.benchmark.quality.utils DocNameExtractor docName

List of usage examples for org.apache.lucene.benchmark.quality.utils DocNameExtractor docName

Introduction

In this page you can find the example usage for org.apache.lucene.benchmark.quality.utils DocNameExtractor docName.

Prototype

public String docName(IndexSearcher searcher, int docid) throws IOException 

Source Link

Document

Extract the name of the input doc from the index.

Usage

From source file:lucene.ri.QualityBenchmark.java

License:Apache License

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;/*from  www .j a  v  a2  s .  co  m*/
    long t1 = System.currentTimeMillis(); // extraction of first doc name we measure also construction of doc name extractor, just in case.
    DocNameExtractor xt = new DocNameExtractor(docNameField);

    for (int i = 0; i < sd.length; i++) {

        String docName = xt.docName(searcher.indexSearcher, 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;
}

From source file:uib.percisionRecall.QualityBenchmark.java

License:Apache License

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;/*w  ww. j  a  va  2  s  . c o m*/
    long t1 = System.currentTimeMillis(); // extraction of first doc name we measure also construction of doc name extractor, just in case.
    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;
}