aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-08-20 21:52:32 +0200
committerJon Bratseth <bratseth@oath.com>2018-08-20 21:52:32 +0200
commitcb48afdebc1b212703bfac6d81739f67e45339a0 (patch)
treefadba01b82cf8959b9b78b38d0a88770a364f9f3 /config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java
parentc7cfd9f4742f398331839ed0f2ceeee55c68a791 (diff)
Revert "Revert "Merge pull request #6626 from vespa-engine/revert-6625-bratseth/generate-rank-profiles-for-all-models-part-2-3""
This reverts commit c7cfd9f4742f398331839ed0f2ceeee55c68a791.
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java')
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java28
1 files changed, 6 insertions, 22 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java
index ab689b88993..0ce6129ef7f 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java
@@ -10,9 +10,7 @@ import com.yahoo.searchdefinition.Search;
import com.yahoo.searchdefinition.SearchBuilder;
import com.yahoo.searchdefinition.parser.ParseException;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import static org.junit.Assert.assertEquals;
@@ -27,7 +25,6 @@ class RankProfileSearchFixture {
private RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
private final QueryProfileRegistry queryProfileRegistry;
private Search search;
- private Map<String, RankProfile> compiledRankProfiles = new HashMap<>();
RankProfileSearchFixture(String rankProfiles) throws ParseException {
this(MockApplicationPackage.createEmpty(), new QueryProfileRegistry(), rankProfiles);
@@ -57,38 +54,25 @@ class RankProfileSearchFixture {
}
public void assertFirstPhaseExpression(String expExpression, String rankProfile) {
- assertEquals(expExpression, compiledRankProfile(rankProfile).getFirstPhaseRanking().getRoot().toString());
+ assertEquals(expExpression, rankProfile(rankProfile).getFirstPhaseRanking().getRoot().toString());
}
public void assertSecondPhaseExpression(String expExpression, String rankProfile) {
- assertEquals(expExpression, compiledRankProfile(rankProfile).getSecondPhaseRanking().getRoot().toString());
+ assertEquals(expExpression, rankProfile(rankProfile).getSecondPhaseRanking().getRoot().toString());
}
public void assertRankProperty(String expValue, String name, String rankProfile) {
- List<RankProfile.RankProperty> rankPropertyList = compiledRankProfile(rankProfile).getRankPropertyMap().get(name);
+ List<RankProfile.RankProperty> rankPropertyList = rankProfile(rankProfile).getRankPropertyMap().get(name);
assertEquals(1, rankPropertyList.size());
assertEquals(expValue, rankPropertyList.get(0).getValue());
}
- public void assertMacro(String expexctedExpression, String macroName, String rankProfile) {
- assertEquals(expexctedExpression,
- compiledRankProfile(rankProfile).getMacros().get(macroName).getRankingExpression().getRoot().toString());
+ public void assertMacro(String expExpression, String macroName, String rankProfile) {
+ assertEquals(expExpression, rankProfile(rankProfile).getMacros().get(macroName).getRankingExpression().getRoot().toString());
}
- public RankProfile compileRankProfile(String rankProfile) {
- RankProfile compiled = rankProfileRegistry.getRankProfile(search, rankProfile).compile(queryProfileRegistry);
- compiledRankProfiles.put(rankProfile, compiled);
- return compiled;
- }
-
- /** Returns the given uncompiled profile */
public RankProfile rankProfile(String rankProfile) {
- return rankProfileRegistry.getRankProfile(search, rankProfile);
- }
-
- /** Returns the given compiled profile, or null if not compiled yet or not present at all */
- public RankProfile compiledRankProfile(String rankProfile) {
- return compiledRankProfiles.get(rankProfile);
+ return rankProfileRegistry.getRankProfile(search, rankProfile).compile(queryProfileRegistry);
}
public Search search() { return search; }