diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-01-11 14:21:09 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-01-11 14:36:14 +0100 |
commit | 695d6e34ac633f137dbd71816aaa3392e4d8725c (patch) | |
tree | e2b7919d7128d723428949341b749d2d135093a3 /config-model | |
parent | c77d54ba02163c07d1f4eb08ab1dc766720f7c1f (diff) |
- Let the limit for large expressions follow LargeExpressions.
- Remove the use of FeatureFlags.largeRankProfile.
Diffstat (limited to 'config-model')
5 files changed, 11 insertions, 13 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java index 2ff9b889a9e..0007fa0d18a 100644 --- a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java +++ b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java @@ -59,7 +59,6 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea private int maxConcurrentMergesPerNode = 16; private int maxMergeQueueSize = 1024; private boolean ignoreMergeQueueLimit = false; - private int largeRankExpressionLimit = 8192; private boolean allowDisableMtls = true; private List<X509Certificate> operatorCertificates = Collections.emptyList(); private double resourceLimitDisk = 0.8; @@ -115,7 +114,6 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea @Override public String jvmOmitStackTraceInFastThrowOption(ClusterSpec.Type type) { return jvmOmitStackTraceInFastThrowOption; } @Override public boolean allowDisableMtls() { return allowDisableMtls; } @Override public List<X509Certificate> operatorCertificates() { return operatorCertificates; } - @Override public int largeRankExpressionLimit() { return largeRankExpressionLimit; } @Override public int maxConcurrentMergesPerNode() { return maxConcurrentMergesPerNode; } @Override public int maxMergeQueueSize() { return maxMergeQueueSize; } @Override public boolean ignoreMergeQueueLimit() { return ignoreMergeQueueLimit; } @@ -160,10 +158,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea containerShutdownTimeout = value; return this; } - public TestProperties largeRankExpressionLimit(int value) { - largeRankExpressionLimit = value; - return this; - } + public TestProperties setFeedConcurrency(double feedConcurrency) { this.feedConcurrency = feedConcurrency; return this; diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/LargeRankExpressions.java b/config-model/src/main/java/com/yahoo/searchdefinition/LargeRankExpressions.java index 3fdea71da2c..a1299c12307 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/LargeRankExpressions.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/LargeRankExpressions.java @@ -10,9 +10,14 @@ import java.util.concurrent.ConcurrentHashMap; public class LargeRankExpressions { private final Map<String, RankExpressionBody> expressions = new ConcurrentHashMap<>(); private final FileRegistry fileRegistry; + private final int limit; public LargeRankExpressions(FileRegistry fileRegistry) { + this(fileRegistry, 8192); + } + public LargeRankExpressions(FileRegistry fileRegistry, int limit) { this.fileRegistry = fileRegistry; + this.limit = limit; } public void add(RankExpressionBody expression) { @@ -29,6 +34,7 @@ public class LargeRankExpressions { } } } + public int limit() { return limit; } /** Returns a read-only map of the ranking constants in this indexed by name */ public Map<String, RankExpressionBody> asMap() { diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/RawRankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/RawRankProfile.java index a33498a37ec..d7bcd295f09 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/RawRankProfile.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/RawRankProfile.java @@ -140,7 +140,6 @@ public class RawRankProfile implements RankProfilesConfig.Producer { private final int numSearchPartitions; private final double termwiseLimit; private final double rankScoreDropLimit; - private final int largeRankExpressionLimit; /** * The rank type definitions used to derive settings for the native rank features @@ -176,7 +175,6 @@ public class RawRankProfile implements RankProfilesConfig.Producer { keepRankCount = compiled.getKeepRankCount(); rankScoreDropLimit = compiled.getRankScoreDropLimit(); ignoreDefaultRankFeatures = compiled.getIgnoreDefaultRankFeatures(); - largeRankExpressionLimit = deployProperties.featureFlags().largeRankExpressionLimit(); rankProperties = new ArrayList<>(compiled.getRankProperties()); Map<String, RankProfile.RankingExpressionFunction> functions = compiled.getFunctions(); @@ -419,7 +417,7 @@ public class RawRankProfile implements RankProfilesConfig.Producer { for (ListIterator<Pair<String, String>> iter = properties.listIterator(); iter.hasNext();) { Pair<String, String> property = iter.next(); String expression = property.getSecond(); - if (expression.length() > largeRankExpressionLimit) { + if (expression.length() > largeRankExpressions.limit()) { String propertyName = property.getFirst(); String functionName = RankingExpression.extractScriptName(propertyName); if (functionName != null) { diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java index c6a10c5530b..fda3e6c16c3 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java @@ -104,8 +104,7 @@ public class ExportingTestCase extends AbstractExportingTestCase { @Test public void testRankExpression() throws IOException, ParseException { - assertCorrectDeriving("rankexpression", null, - new TestProperties().largeRankExpressionLimit(1024), new TestableDeployLogger()); + assertCorrectDeriving("rankexpression"); } @Test diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionsTestCase.java index ebc8ceacc50..f4742be6b30 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionsTestCase.java @@ -115,9 +115,9 @@ public class RankingExpressionsTestCase extends AbstractSchemaTestCase { @Test public void testLargeInheritedFunctions() throws IOException, ParseException { - ModelContext.Properties properties = new TestProperties().largeRankExpressionLimit(50); + ModelContext.Properties properties = new TestProperties(); RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); - LargeRankExpressions largeExpressions = new LargeRankExpressions(new MockFileRegistry()); + LargeRankExpressions largeExpressions = new LargeRankExpressions(new MockFileRegistry(), 50); QueryProfileRegistry queryProfiles = new QueryProfileRegistry(); ImportedMlModels models = new ImportedMlModels(); Schema schema = createSearch("src/test/examples/largerankingexpressions", properties, rankProfileRegistry); |