Apache Lucene open-source search software
ReadTokensTask now converts tokens to their indexed forms (char[]->byte[]), just as the indexer does. This allows measurement of the conversion process, which is important for analysis components that customize it, e.g. (ICU)CollationKeyFilter.
Steven Rowe1caaea77b2ed
diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.javaindex fa0ae999b45..f702cb8ee7f 100644--- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java+++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java@@ -22,6 +22,7 @@ import java.util.List;import org.apache.lucene.analysis.Analyzer;import org.apache.lucene.analysis.TokenStream;+import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute;import org.apache.lucene.benchmark.byTask.PerfRunData;import org.apache.lucene.benchmark.byTask.feeds.DocMaker;import org.apache.lucene.document.Document;@@ -98,8 +99,11 @@ public class ReadTokensTask extends PerfTask {// reset the TokenStream to the first tokenstream.reset();- while(stream.incrementToken())+ TermToBytesRefAttribute termAtt = stream.getAttribute(TermToBytesRefAttribute.class);+ while(stream.incrementToken()) {+ termAtt.fillBytesRef();tokenCount++;+ }}totalTokenCount += tokenCount;return tokenCount;