Skip to content

Apache Lucene open-source search software

LUCENE-2059: allow TrecContentSource not to change the docname

Robert Muir731f41844855
diff --git a/contrib/benchmark/CHANGES.txt b/contrib/benchmark/CHANGES.txt
index 7e54436fb8a..5be4dfb8b81 100644
--- a/contrib/benchmark/CHANGES.txt
+++ b/contrib/benchmark/CHANGES.txt
@@ -4,6 +4,13 @@ The Benchmark contrib package contains code for benchmarking Lucene in a variety
$Id:$
+11/12/2009
+ LUCENE-2059: allow TrecContentSource not to change the docname.
+ Previously, it would always append the iteration # to the docname.
+ With the new option content.source.excludeIteration, you can disable this.
+ The resulting index can then be used with the quality package to measure
+ relevance. (Robert Muir)
+
11/12/2009
LUCENE-2058: specify trec_eval submission output from the command line.
Previously, 4 arguments were required, but the third was unused. The
diff --git a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecContentSource.java b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecContentSource.java
index adc3a3f9fd7..bf0ecb79d0b 100644
--- a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecContentSource.java
+++ b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecContentSource.java
@@ -48,6 +48,7 @@ import org.apache.lucene.benchmark.byTask.utils.StringBufferReader;
* <li><b>html.parser</b> - specifies the {@link HTMLParser} class to use for
* parsing the TREC documents content (<b>default=DemoHTMLParser</b>).
* <li><b>content.source.encoding</b> - if not specified, ISO-8859-1 is used.
+ * <li><b>content.source.excludeIteration</b> - if true, do not append iteration number to docname
* </ul>
*/
public class TrecContentSource extends ContentSource {
@@ -91,6 +92,7 @@ public class TrecContentSource extends ContentSource {
BufferedReader reader;
int iteration = 0;
HTMLParser htmlParser;
+ private boolean excludeDocnameIteration;
private DateFormatInfo getDateFormatInfo() {
DateFormatInfo dfi = dateFormats.get();
@@ -256,7 +258,8 @@ public class TrecContentSource extends ContentSource {
read(docBuf, DOCNO, true, false, null);
name = docBuf.substring(DOCNO.length(), docBuf.indexOf(TERMINATING_DOCNO,
DOCNO.length()));
- name = name + "_" + iteration;
+ if (!excludeDocnameIteration)
+ name = name + "_" + iteration;
// 3. skip until doc header
docBuf.setLength(0);
@@ -342,6 +345,7 @@ public class TrecContentSource extends ContentSource {
if (encoding == null) {
encoding = "ISO-8859-1";
}
+ excludeDocnameIteration = config.get("content.source.excludeIteration", false);
}
}