diff --git a/contrib/benchmark/CHANGES.txt b/contrib/benchmark/CHANGES.txt index 0d3d15de21c..0afd04f7db0 100644 --- a/contrib/benchmark/CHANGES.txt +++ b/contrib/benchmark/CHANGES.txt @@ -4,6 +4,10 @@ The Benchmark contrib package contains code for benchmarking Lucene in a variety $Id:$ +11/07/2009 + LUCENE-2042: Added print.hits.field, to print each hit from the + Search* tasks. (Mike McCandless) + 11/04/2009 LUCENE-2029: Added doc.body.stored and doc.body.tokenized; each falls back to the non-body variant as its default. (Mike McCandless) diff --git a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java index 746ebadefd9..41089490181 100644 --- a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java +++ b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java @@ -51,7 +51,10 @@ import org.apache.lucene.store.Directory; * Otherwise a reader is opened at start and closed at the end. *
* The search.num.hits
config parameter sets
- * the top number of hits to collect during searching.
+ * the top number of hits to collect during searching. If
+ * print.hits.field
is set, then each hit is
+ * printed along with the value of that field.
Other side effects: none.
*/
public abstract class ReadTask extends PerfTask {
@@ -107,6 +110,20 @@ public abstract class ReadTask extends PerfTask {
} else {
hits = searcher.search(q, numHits);
}
+
+ final String printHitsField = getRunData().getConfig().get("print.hits.field", null);
+ if (printHitsField != null && printHitsField.length() > 0) {
+ final IndexReader r = searcher.getIndexReader();
+ System.out.println("totalHits = " + hits.totalHits);
+ System.out.println("maxDoc() = " + r.maxDoc());
+ System.out.println("numDocs() = " + r.numDocs());
+ for(int i=0;i