From 03825866bf36fef5a984303532b940337d98aa77 Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Mon, 16 Dec 2024 14:50:00 +0100 Subject: [PATCH] Add doc link to warning when there are fieldset inconstencies --- .../com/yahoo/schema/processing/FieldSetSettings.java | 11 +++++++---- .../schema/processing/FieldSetSettingsTestCase.java | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/config-model/src/main/java/com/yahoo/schema/processing/FieldSetSettings.java b/config-model/src/main/java/com/yahoo/schema/processing/FieldSetSettings.java index f194a60a9e2f..958665009185 100644 --- a/config-model/src/main/java/com/yahoo/schema/processing/FieldSetSettings.java +++ b/config-model/src/main/java/com/yahoo/schema/processing/FieldSetSettings.java @@ -26,7 +26,7 @@ // (this requires adding normalizing and stemming settings to FieldSet). public class FieldSetSettings extends Processor { - private static String fieldSetDocUrl = "https://docs.vespa.ai/en/reference/schema-reference.html#fieldset"; + private static final String fieldSetDocUrl = "https://docs.vespa.ai/en/reference/schema-reference.html#fieldset"; public FieldSetSettings(Schema schema, DeployLogger deployLogger, @@ -66,7 +66,8 @@ private void checkMatching(Schema schema, FieldSet fieldSet) { if ( ! matching.equals(fieldMatching)) { warn(schema, field.asField(), "The matching settings for the fields in " + fieldSet + " are inconsistent " + - "(explicitly or because of field type). This may lead to recall and ranking issues."); + "(explicitly or because of field type). This may lead to recall and ranking issues. " + + "See " + fieldSetDocUrl); return; } } @@ -85,7 +86,8 @@ private void checkNormalization(Schema schema, FieldSet fieldSet) { if ( ! normalizing.equals(fieldNorm)) { warn(schema, field.asField(), "The normalization settings for the fields in " + fieldSet + " are inconsistent " + - "(explicitly or because of field type). This may lead to recall and ranking issues."); + "(explicitly or because of field type). This may lead to recall and ranking issues. " + + "See " + fieldSetDocUrl); return; } } @@ -104,7 +106,8 @@ private void checkStemming(Schema schema, FieldSet fieldSet) { warn(schema, field.asField(), "The stemming settings for the fields in the fieldset '"+fieldSet.getName()+ "' are inconsistent (explicitly or because of field type). " + - "This may lead to recall and ranking issues."); + "This may lead to recall and ranking issues. " + + "See " + fieldSetDocUrl); return; } } diff --git a/config-model/src/test/java/com/yahoo/schema/processing/FieldSetSettingsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/FieldSetSettingsTestCase.java index 57155f3062ec..34e1a1f6ce18 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/FieldSetSettingsTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/FieldSetSettingsTestCase.java @@ -20,14 +20,15 @@ public void legalFieldTypeMix() { @Test public void warnableFieldTypeMix() { var logger = new TestableDeployLogger(); - assertDoesNotThrow(() -> createFromStrings(logger, childSd("fieldset default { fields: ci,ps }"), parentSd())); + assertDoesNotThrow(() -> createFromStrings(logger, childSd("fieldset default { fields: ci,ps,ps2 }"), parentSd())); assertArrayEquals(new String[]{ "For schema 'child', field 'ps': " + "The matching settings for the fields in fieldset 'default' are inconsistent (explicitly or because of field type). " + - "This may lead to recall and ranking issues.", + "This may lead to recall and ranking issues. See https://docs.vespa.ai/en/reference/schema-reference.html#fieldset", "For schema 'child', field 'ps': " + "The normalization settings for the fields in fieldset 'default' are inconsistent (explicitly or because of field type). " + - "This may lead to recall and ranking issues."}, logger.warnings.toArray()); + "This may lead to recall and ranking issues. See https://docs.vespa.ai/en/reference/schema-reference.html#fieldset"}, + logger.warnings.toArray()); } @Test