aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2023-07-07 13:12:20 +0200
committerGitHub <noreply@github.com>2023-07-07 13:12:20 +0200
commitc68d67a32e903c041e878fcfd03c7f2a694ca4e5 (patch)
tree5487938838eb041a07f0690ccef79c4af66fbf14
parent38787ad47a7c84658215c4832f064859db862783 (diff)
parentc682a8656d83d29b7136f29620fbb8e49d47a9fc (diff)
Merge pull request #27696 from vespa-engine/hmusum/add-warning-when-using-deprecated-index-or-attribute-name
Add deprecation warning when using another name for attribute or index
-rw-r--r--config-model/src/main/javacc/SchemaParser.jj10
-rw-r--r--config-model/src/test/java/com/yahoo/schema/IndexSettingsTestCase.java2
2 files changed, 11 insertions, 1 deletions
diff --git a/config-model/src/main/javacc/SchemaParser.jj b/config-model/src/main/javacc/SchemaParser.jj
index 9a38fdc673e..b2cb258c0ab 100644
--- a/config-model/src/main/javacc/SchemaParser.jj
+++ b/config-model/src/main/javacc/SchemaParser.jj
@@ -992,6 +992,11 @@ void attribute(ParsedField field) :
{
<ATTRIBUTE> [name = identifier()]
{
+ // TODO: Remove support for attribute with different name than field name in Vespa 9
+ if ( ! name.equals(field.name()))
+ deployLogger.logApplicationPackage(Level.WARNING, "Creating an attribute for field '" + field.name() +
+ "' with a different name '" + name + "' than the field name" +
+ " is deprecated, and support will be removed in Vespa 9. Define a field with the wanted name outside the document instead.");
ParsedAttribute attr = field.attributeFor(name);
}
( (<COLON> attributeSetting(attr))
@@ -1506,6 +1511,11 @@ void indexInsideField(ParsedField field) :
{
<INDEX> [indexName = identifier()]
{
+ // TODO: Remove support for index with different name than field name in Vespa 9
+ if ( ! indexName.equals(field.name()))
+ deployLogger.logApplicationPackage(Level.WARNING, "Creating an index for field '" + field.name() +
+ "' with a different name '" + indexName + "' than the field name" +
+ " is deprecated, and support will be removed in Vespa 9. Define a field with the wanted name outside the document instead.");
op = new ParsedIndex(indexName);
}
( (<COLON> indexBody(op) (<COMMA> indexBody(op))*) |
diff --git a/config-model/src/test/java/com/yahoo/schema/IndexSettingsTestCase.java b/config-model/src/test/java/com/yahoo/schema/IndexSettingsTestCase.java
index b1d502dec36..7990d76d023 100644
--- a/config-model/src/test/java/com/yahoo/schema/IndexSettingsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/IndexSettingsTestCase.java
@@ -37,7 +37,7 @@ public class IndexSettingsTestCase extends AbstractSchemaTestCase {
}
@Test
- void requireThatInterlavedFeaturesAreSetOnExtraField() throws ParseException {
+ void requireThatInterleavedFeaturesAreSetOnExtraField() throws ParseException {
ApplicationBuilder builder = ApplicationBuilder.createFromString(joinLines(
"search test {",
" document test {",