You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2021/09/09 16:37:33 UTC
[lucene-solr] branch branch_8x updated: LUCENE-10091 Fix some old
errors in the benchmark module (#2566)
This is an automated email from the ASF dual-hosted git repository.
mikemccand pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new 8640db6 LUCENE-10091 Fix some old errors in the benchmark module (#2566)
8640db6 is described below
commit 8640db6079813ce2171b25e6d6729ee15ed90085
Author: xiaoshi <xi...@gmail.com>
AuthorDate: Fri Sep 10 00:37:18 2021 +0800
LUCENE-10091 Fix some old errors in the benchmark module (#2566)
---
lucene/benchmark/conf/collector-small.alg | 2 +-
lucene/benchmark/conf/collector.alg | 2 +-
.../benchmark/byTask/tasks/NewAnalyzerTask.java | 26 +++++++++++-----------
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/lucene/benchmark/conf/collector-small.alg b/lucene/benchmark/conf/collector-small.alg
index e4801ff..7b333e4 100644
--- a/lucene/benchmark/conf/collector-small.alg
+++ b/lucene/benchmark/conf/collector-small.alg
@@ -21,7 +21,7 @@
# Fully Qualified Class Name of a Collector with a empty constructor
# topScoreDocOrdered - Creates a TopScoreDocCollector that requires in order docs
# topScoreDocUnordered - Like above, but allows out of order
-collector.class=coll:topScoreDocOrdered:topScoreDocUnordered:topScoreDocOrdered:topScoreDocUnordered
+collector.class=coll:topScoreDoc
analyzer=org.apache.lucene.analysis.core.WhitespaceAnalyzer
directory=FSDirectory
diff --git a/lucene/benchmark/conf/collector.alg b/lucene/benchmark/conf/collector.alg
index 237f33b..d9381f5 100644
--- a/lucene/benchmark/conf/collector.alg
+++ b/lucene/benchmark/conf/collector.alg
@@ -21,7 +21,7 @@
# Fully Qualified Class Name of a Collector with a empty constructor
# topScoreDocOrdered - Creates a TopScoreDocCollector that requires in order docs
# topScoreDocUnordered - Like above, but allows out of order
-collector.class=coll:topScoreDocOrdered:topScoreDocUnordered:topScoreDocOrdered:topScoreDocUnordered
+collector.class=coll:topScoreDoc
analyzer=org.apache.lucene.analysis.core.WhitespaceAnalyzer
directory=FSDirectory
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java
index 1673d34..f1c9ecd 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java
@@ -16,16 +16,17 @@
*/
package org.apache.lucene.benchmark.byTask.tasks;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.benchmark.byTask.PerfRunData;
-import org.apache.lucene.benchmark.byTask.utils.AnalyzerFactory;
-import org.apache.lucene.util.Version;
-
import java.io.IOException;
import java.io.StreamTokenizer;
import java.io.StringReader;
-import java.util.*;
import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.CharArraySet;
+import org.apache.lucene.benchmark.byTask.PerfRunData;
+import org.apache.lucene.benchmark.byTask.utils.AnalyzerFactory;
/**
* Create a new {@link org.apache.lucene.analysis.Analyzer} and set it in the getRunData() for use by all future tasks.
@@ -42,14 +43,13 @@ public class NewAnalyzerTask extends PerfTask {
public static final Analyzer createAnalyzer(String className) throws Exception{
final Class<? extends Analyzer> clazz = Class.forName(className).asSubclass(Analyzer.class);
- try {
- // first try to use a ctor with version parameter (needed for many new Analyzers that have no default one anymore
- Constructor<? extends Analyzer> cnstr = clazz.getConstructor(Version.class);
- return cnstr.newInstance(Version.LATEST);
- } catch (NoSuchMethodException nsme) {
- // otherwise use default ctor
- return clazz.newInstance();
+ Constructor<? extends Analyzer> cnstr;
+ if (className.equals("org.apache.lucene.analysis.core.StopAnalyzer")) {
+ cnstr = clazz.getConstructor(CharArraySet.class);
+ return cnstr.newInstance(CharArraySet.EMPTY_SET);
}
+ cnstr = clazz.getConstructor();
+ return cnstr.newInstance();
}
@Override