diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-01-12 08:45:52 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-01-12 08:45:52 +0100 |
commit | 13d6a727e8c2c23d04e8bca980588abbd0424d69 (patch) | |
tree | ae91d5a0b9b9f7ea3ed277d3c83915145e303682 /config-model/src/main/java | |
parent | 2ba43adc46b266debadad37b47e5a3334826bfcc (diff) |
Resolve normalization correctly when match is 'word'.
Diffstat (limited to 'config-model/src/main/java')
-rw-r--r-- | config-model/src/main/java/com/yahoo/schema/derived/VsmFields.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/derived/VsmFields.java b/config-model/src/main/java/com/yahoo/schema/derived/VsmFields.java index f05f8b17762..a590a3a74bf 100644 --- a/config-model/src/main/java/com/yahoo/schema/derived/VsmFields.java +++ b/config-model/src/main/java/com/yahoo/schema/derived/VsmFields.java @@ -46,7 +46,7 @@ public class VsmFields extends Derived implements VsmfieldsConfig.Producer { @Override protected void derive(SDDocumentType document, Schema schema) { super.derive(document, schema); - StreamingDocumentType docType=getDocumentType(document.getName()); + StreamingDocumentType docType = getDocumentType(document.getName()); if (docType == null) { docType = new StreamingDocumentType(document.getName(), schema.fieldSets()); doctypes.put(document.getName(), docType); @@ -56,7 +56,7 @@ public class VsmFields extends Derived implements VsmfieldsConfig.Producer { } } - protected void derive(StreamingDocumentType document, SDField field) { + private void derive(StreamingDocumentType document, SDField field) { if (field.usesStructOrMap()) { if (GeoPos.isAnyPos(field)) { StreamingField streamingField = new StreamingField(field); @@ -97,8 +97,7 @@ public class VsmFields extends Derived implements VsmfieldsConfig.Producer { fields.put(name, field); } - /** Returns a streaming index, or null if there is none with this name */ - public StreamingDocumentType getDocumentType(String name) { + private StreamingDocumentType getDocumentType(String name) { return doctypes.get(name); } @@ -263,9 +262,14 @@ public class VsmFields extends Derived implements VsmfieldsConfig.Producer { } private static VsmfieldsConfig.Fieldspec.Normalize.Enum toNormalize(Matching matching) { + // The ordering/priority below is important. + // exact = > lowercase only if (matching.getType() == MatchType.EXACT) return VsmfieldsConfig.Fieldspec.Normalize.Enum.LOWERCASE; - if (matching.getType() == MatchType.WORD) return VsmfieldsConfig.Fieldspec.Normalize.Enum.LOWERCASE; + // cased takes priority if (matching.getCase() == Case.CASED) return VsmfieldsConfig.Fieldspec.Normalize.Enum.NONE; + // word implies lowercase (used for attributes) + if (matching.getType() == MatchType.WORD) return VsmfieldsConfig.Fieldspec.Normalize.Enum.LOWERCASE; + // Everything else return VsmfieldsConfig.Fieldspec.Normalize.LOWERCASE_AND_FOLD; } |