diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-03-24 10:26:46 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-03-24 10:26:46 +0100 |
commit | ff7f14ba4cafa7727d6246dca17bce35a32b91e5 (patch) | |
tree | 541821341a36ab7a281366905a4731ccf620f68e /config-model | |
parent | 047a15e3b1c4afcb352713f3948b78f2f3a646cf (diff) |
Also allow hash dictionary for multivalue numeric fields.
Diffstat (limited to 'config-model')
2 files changed, 20 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/DictionaryProcessor.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/DictionaryProcessor.java index 92ceb8e5e44..fd567ec2d54 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/DictionaryProcessor.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/DictionaryProcessor.java @@ -27,7 +27,7 @@ public class DictionaryProcessor extends Processor { if (dictionary == null) continue; Attribute attribute = field.getAttribute(); - if (attribute.getDataType() instanceof NumericDataType ) { + if (attribute.getDataType().getPrimitiveType() instanceof NumericDataType ) { if (attribute.isFastSearch()) { attribute.setDictionary(dictionary); } else { diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java index 256858b372e..ba51caca0f7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/DictionaryTestCase.java @@ -50,12 +50,13 @@ public class DictionaryTestCase { void verifyNumericDictionaryControl(Dictionary.Type expected, AttributesConfig.Attribute.Dictionary.Type.Enum expectedConfig, + String type, String ... cfg) throws ParseException { String def = TestUtil.joinLines( "search test {", " document test {", - " field n1 type int {", + " field n1 type " + type + " {", " indexing: summary | attribute", " attribute:fast-search", TestUtil.joinLines(cfg), @@ -72,18 +73,35 @@ public class DictionaryTestCase { public void testNumericBtreeSettings() throws ParseException { verifyNumericDictionaryControl(Dictionary.Type.BTREE, AttributesConfig.Attribute.Dictionary.Type.BTREE, + "int", "dictionary:btree"); } @Test public void testNumericHashSettings() throws ParseException { verifyNumericDictionaryControl(Dictionary.Type.HASH, AttributesConfig.Attribute.Dictionary.Type.HASH, + "int", "dictionary:hash"); } @Test public void testNumericBtreeAndHashSettings() throws ParseException { verifyNumericDictionaryControl(Dictionary.Type.BTREE_AND_HASH, AttributesConfig.Attribute.Dictionary.Type.BTREE_AND_HASH, + "int", + "dictionary:btree", "dictionary:hash"); + } + @Test + public void testNumericArrayBtreeAndHashSettings() throws ParseException { + verifyNumericDictionaryControl(Dictionary.Type.BTREE_AND_HASH, + AttributesConfig.Attribute.Dictionary.Type.BTREE_AND_HASH, + "array<int>", + "dictionary:btree", "dictionary:hash"); + } + @Test + public void testNumericWSetBtreeAndHashSettings() throws ParseException { + verifyNumericDictionaryControl(Dictionary.Type.BTREE_AND_HASH, + AttributesConfig.Attribute.Dictionary.Type.BTREE_AND_HASH, + "weightedset<int>", "dictionary:btree", "dictionary:hash"); } @Test |