LUCENE-6202 - added BlendedInfixSuggester and FreeTextSuggester to LookupBenchmarkTest

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1655260 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tommaso Teofili 2015-01-28 11:23:38 +00:00
parent 41729528c3
commit 309bf4a251
1 changed files with 9 additions and 3 deletions

View File

@ -36,11 +36,14 @@ import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester;
import org.apache.lucene.search.suggest.analyzing.AnalyzingSuggester;
import org.apache.lucene.search.suggest.analyzing.BlendedInfixSuggester;
import org.apache.lucene.search.suggest.analyzing.FreeTextSuggester;
import org.apache.lucene.search.suggest.analyzing.FuzzySuggester;
import org.apache.lucene.search.suggest.fst.FSTCompletionLookup;
import org.apache.lucene.search.suggest.fst.WFSTCompletionLookup;
import org.apache.lucene.search.suggest.jaspell.JaspellLookup;
import org.apache.lucene.search.suggest.tst.TSTLookup;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.*;
import org.junit.BeforeClass;
@ -59,7 +62,9 @@ public class LookupBenchmarkTest extends LuceneTestCase {
JaspellLookup.class,
TSTLookup.class,
FSTCompletionLookup.class,
WFSTCompletionLookup.class
WFSTCompletionLookup.class,
BlendedInfixSuggester.class,
FreeTextSuggester.class
);
private final static int rounds = 15;
@ -162,8 +167,9 @@ public class LookupBenchmarkTest extends LuceneTestCase {
lookup = cls.newInstance();
} catch (InstantiationException e) {
Analyzer a = new MockAnalyzer(random, MockTokenizer.KEYWORD, false);
if (cls == AnalyzingInfixSuggester.class) {
lookup = new AnalyzingInfixSuggester(FSDirectory.open(createTempDir("LookupBenchmarkTest")), a);
if (cls == AnalyzingInfixSuggester.class || cls == BlendedInfixSuggester.class) {
Constructor<? extends Lookup> ctor = cls.getConstructor(Directory.class, Analyzer.class);
lookup = ctor.newInstance(FSDirectory.open(createTempDir("LookupBenchmarkTest")), a);
} else {
Constructor<? extends Lookup> ctor = cls.getConstructor(Analyzer.class);
lookup = ctor.newInstance(a);