Index: contrib/benchmark/CHANGES.txt =================================================================== --- contrib/benchmark/CHANGES.txt (revision 833605) +++ contrib/benchmark/CHANGES.txt (working copy) @@ -4,6 +4,10 @@ $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) Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java =================================================================== --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java (revision 833603) +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java (working copy) @@ -51,7 +51,10 @@ * 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 @@
} 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