Skip to content

Commit

Permalink
expand warning with information about fields.
Browse files Browse the repository at this point in the history
make sure that we report back the original fieldset matching
as the effective outcome for now.
  • Loading branch information
arnej27959 committed Dec 18, 2024
1 parent 0dc4bfa commit 7f396b8
Showing 2 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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). " +

0 comments on commit 7f396b8

Please sign in to comment.