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

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

Introduction

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

Prototype

public DocNameExtractor(final String docNameField) 

Source Link

Document

Constructor for DocNameExtractor.

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   ww w. j  a v  a 2  s.  c  om
    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;/*from   ww  w.j  a v a2  s . c  om*/
    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;
}