diff options
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude/query/parser/test/ParsingTester.java')
-rw-r--r-- | container-search/src/test/java/com/yahoo/prelude/query/parser/test/ParsingTester.java | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/query/parser/test/ParsingTester.java b/container-search/src/test/java/com/yahoo/prelude/query/parser/test/ParsingTester.java index fd7e4cbe0e6..17155fff5de 100644 --- a/container-search/src/test/java/com/yahoo/prelude/query/parser/test/ParsingTester.java +++ b/container-search/src/test/java/com/yahoo/prelude/query/parser/test/ParsingTester.java @@ -11,8 +11,8 @@ import com.yahoo.prelude.IndexFacts; import com.yahoo.prelude.IndexModel; import com.yahoo.prelude.query.Item; import com.yahoo.prelude.query.NullItem; -import com.yahoo.language.process.SpecialTokenRegistry; -import com.yahoo.language.process.SpecialTokens; +import com.yahoo.prelude.query.parser.SpecialTokenRegistry; +import com.yahoo.prelude.query.parser.SpecialTokens; import com.yahoo.search.Query; import com.yahoo.search.config.IndexInfoConfig; import com.yahoo.search.query.parser.Parsable; @@ -20,9 +20,6 @@ import com.yahoo.search.query.parser.Parser; import com.yahoo.search.query.parser.ParserEnvironment; import com.yahoo.search.query.parser.ParserFactory; -import java.util.ArrayList; -import java.util.List; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -35,7 +32,7 @@ import static org.junit.Assert.assertTrue; public class ParsingTester { private static final Linguistics linguistics = new SimpleLinguistics(); - private final IndexFacts indexFacts; + private IndexFacts indexFacts; private SpecialTokenRegistry tokenRegistry; public ParsingTester() { @@ -52,10 +49,11 @@ public class ParsingTester { public ParsingTester(IndexFacts indexFacts, SpecialTokens specialTokens) { indexFacts.freeze(); + specialTokens.freeze(); this.indexFacts = indexFacts; tokenRegistry = new SpecialTokenRegistry(); - tokenRegistry = new SpecialTokenRegistry(List.of(specialTokens)); + tokenRegistry.addSpecialTokens(specialTokens); } /** @@ -74,13 +72,13 @@ public class ParsingTester { * This can be used to add new tokens and passing the resulting special tokens to the constructor of this. */ public static SpecialTokens createSpecialTokens() { - List<SpecialTokens.Token> tokens = new ArrayList<>(); - tokens.add(new SpecialTokens.Token("c++")); - tokens.add(new SpecialTokens.Token(".net", "dotnet")); - tokens.add(new SpecialTokens.Token("tcp/ip")); - tokens.add(new SpecialTokens.Token("c#")); - tokens.add(new SpecialTokens.Token("special-token-fs","firstsecond")); - return new SpecialTokens("default", tokens); + SpecialTokens tokens = new SpecialTokens("default"); + tokens.addSpecialToken("c++", null); + tokens.addSpecialToken(".net", "dotnet"); + tokens.addSpecialToken("tcp/ip", null); + tokens.addSpecialToken("c#", null); + tokens.addSpecialToken("special-token-fs","firstsecond"); + return tokens; } /** |