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 f1937255273..f23712d8cac 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 @@ -71,11 +71,26 @@ private void checkMatching(Schema schema, FieldSet fieldSet) { matching = fieldMatching; } else { 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. " + - "The matching setting that will be used for this fieldset is " + matching.getType() + ". " + - "See " + fieldSetDocUrl); + final var buf = new StringBuilder(); + buf.append("For schema '").append(schema.getName()).append("': "); + buf.append("The matching settings in ").append(fieldSet); + buf.append(" are inconsistent (explicitly or because of field type). "); + buf.append("This may lead to recall and ranking issues. "); + Matching original = fieldSet.getMatching(); + if (original == null) { + buf.append("The fieldset will use matching TEXT. "); + } else { + buf.append("The fieldset will use matching ").append(original.getType()).append(". "); + } + var list = fieldSet.getFieldNames().stream() + .map(name -> schema.getField(name)) + .filter(f -> (f != null)) + .filter(f -> (f.getMatching() != null)) + .map(f -> " Field '" + f.asField().getName() + "' has matching " + f.getMatching().getType()) + .toList(); + buf.append(list); + buf.append(" See ").append(fieldSetDocUrl); + deployLogger.logApplicationPackage(Level.WARNING, buf.toString()); // TODO: Remove (see FieldSetSettingsTestCase#inconsistentMatchingShouldStillSetMatchingForFieldSet) // but when doing so matching for a fieldset might change 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 610655c5810..e963b47bca5 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 @@ -29,9 +29,10 @@ public void warnableFieldTypeMix() { var logger = new TestableDeployLogger(); assertDoesNotThrow(() -> createFromStrings(logger, childSd("fieldset default { fields: ci,ps }"), 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. The matching setting that will be used for this fieldset is TEXT. " + + "For schema 'child': " + + "The matching settings in fieldset 'default' are inconsistent (explicitly or because of field type). " + + "This may lead to recall and ranking issues. The fieldset will use matching TEXT. " + + "[ Field 'ci' has matching TEXT, Field 'ps' has matching WORD] " + "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). " +