diff options
author | Tor Egge <Tor.Egge@online.no> | 2024-03-26 15:02:35 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2024-03-26 15:02:35 +0100 |
commit | 0377afe9749ca49bfb38c7b621df9e34db525e6c (patch) | |
tree | 5db09bdf47167329133706c2309e40c0935b81aa /config-model/src/main/java/com/yahoo | |
parent | e0c4e2e95a760863b6b7737a41fe58e3857b6486 (diff) |
Add helper function for creating warning message.
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/application/validation/StreamingValidator.java | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/StreamingValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/StreamingValidator.java index bcaf09426f6..86384135e12 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/StreamingValidator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/StreamingValidator.java @@ -39,12 +39,15 @@ public class StreamingValidator implements Validator { } } + private static void logWarning(String cluster, Schema schema, ImmutableSDField sd, DeployLogger logger, String message) { + logger.logApplicationPackage(Level.WARNING, "For search cluster '" + cluster + + "', streaming schema '" + schema.getName() + "', SD field '" + sd.getName() + "': " + message); + } + private static void warnStreamingGramMatching(String cluster, Schema schema, DeployLogger logger) { for (ImmutableSDField sd : schema.allConcreteFields()) { if (sd.getMatching().getType() == MatchType.GRAM) { - logger.logApplicationPackage(Level.WARNING, "For search cluster '" + cluster + "', streaming schema '" + schema.getName() + - "', SD field '" + sd.getName() + - "': n-gram matching is not supported for streaming search."); + logWarning(cluster, schema, sd, logger, "n-gram matching is not supported for streaming search."); } } } @@ -55,12 +58,12 @@ public class StreamingValidator implements Validator { private static void warnStreamingAttributes(String cluster, Schema schema, DeployLogger logger) { for (ImmutableSDField sd : schema.allConcreteFields()) { if (sd.doesAttributing()) { - warnStreamingAttribute(cluster, schema.getName(), sd, logger); + warnStreamingAttribute(cluster, schema, sd, logger); } } } - private static void warnStreamingAttribute(String cluster, String schema, ImmutableSDField sd, DeployLogger logger) { + private static void warnStreamingAttribute(String cluster, Schema schema, ImmutableSDField sd, DeployLogger logger) { // If the field is numeric, we can't print this, because we may have converted the field to // attribute indexing ourselves (IntegerIndex2Attribute) if (sd.getDataType() instanceof NumericDataType) return; @@ -68,18 +71,13 @@ public class StreamingValidator implements Validator { if (sd.getDataType() instanceof TensorDataType) { for (var fieldAttribute : sd.getAttributes().values()) { if (fieldAttribute.hnswIndexParams().isPresent()) { - logger.logApplicationPackage(Level.WARNING, - "For search cluster '" + cluster + "', streaming schema '" + schema + - "', SD field '" + sd.getName() + - "': hnsw index is not relevant and not supported, ignoring setting"); + logWarning(cluster, schema, sd, logger, + "hnsw index is not relevant and not supported, ignoring setting"); } } return; } else if (sd.getDataType() == DataType.PREDICATE) { - logger.logApplicationPackage(Level.WARNING, - "For search cluster '" + cluster + "', streaming schema '" + schema + - "', SD field '" + sd.getName() + - "': field type predicate is not supported for streaming search"); + logWarning(cluster, schema, sd, logger, "field type predicate is not supported for streaming search"); } } @@ -98,17 +96,15 @@ public class StreamingValidator implements Validator { private static void warnStreamingIndexFields(String cluster, Schema schema, DeployLogger logger) { for (ImmutableSDField sd : schema.allConcreteFields()) { if (sd.doesIndexing()) { - warnStreamingIndexField(cluster, schema.getName(), sd, logger); + warnStreamingIndexField(cluster, schema, sd, logger); } } } - private static void warnStreamingIndexField(String cluster, String schema, ImmutableSDField sd, DeployLogger logger) { + private static void warnStreamingIndexField(String cluster, Schema schema, ImmutableSDField sd, DeployLogger logger) { if (sd.getDataType() == DataType.URI) { - logger.logApplicationPackage(Level.WARNING, - "For search cluster '" + cluster + "', streaming schema '" + schema + - "', SD field '" + sd.getName() + - "': field type uri is not supported for streaming search, it will be handled as a string field"); + logWarning(cluster, schema, sd, logger, + "field type uri is not supported for streaming search, it will be handled as a string field"); } } |