diff options
author | Geir Storli <geirst@oath.com> | 2018-06-19 14:24:04 +0200 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2018-06-19 14:24:04 +0200 |
commit | 66764d55be0aff4224b0171d4ab6450007e1e4cb (patch) | |
tree | 3e8f5c7eb0928266a26c2ed7e581678bc6eb6aa1 /config-model/src/test | |
parent | 0b8db6130a386423d5e372fd6beef7d031fca085 (diff) |
Support attribute settings (etc. fast-search) for struct field attributes.
Diffstat (limited to 'config-model/src/test')
7 files changed, 21 insertions, 16 deletions
diff --git a/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg b/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg index 9e6b5cea55e..d42ed223045 100644 --- a/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg +++ b/config-model/src/test/derived/array_of_struct_attribute/attributes.cfg @@ -3,7 +3,7 @@ attribute[].datatype STRING attribute[].collectiontype ARRAY attribute[].removeifzero false attribute[].createifnonexistent false -attribute[].fastsearch false +attribute[].fastsearch true attribute[].huge false attribute[].sortascending true attribute[].sortfunction UCA diff --git a/config-model/src/test/derived/array_of_struct_attribute/test.sd b/config-model/src/test/derived/array_of_struct_attribute/test.sd index 5b2d50cbdba..3678c2942b5 100644 --- a/config-model/src/test/derived/array_of_struct_attribute/test.sd +++ b/config-model/src/test/derived/array_of_struct_attribute/test.sd @@ -8,6 +8,7 @@ search test { indexing: summary struct-field name { indexing: attribute + attribute: fast-search } struct-field weight { indexing: attribute diff --git a/config-model/src/test/derived/map_attribute/attributes.cfg b/config-model/src/test/derived/map_attribute/attributes.cfg index cdd929a1818..4e0c3d60338 100644 --- a/config-model/src/test/derived/map_attribute/attributes.cfg +++ b/config-model/src/test/derived/map_attribute/attributes.cfg @@ -3,7 +3,7 @@ attribute[].datatype STRING attribute[].collectiontype ARRAY attribute[].removeifzero false attribute[].createifnonexistent false -attribute[].fastsearch false +attribute[].fastsearch true attribute[].huge false attribute[].sortascending true attribute[].sortfunction UCA diff --git a/config-model/src/test/derived/map_attribute/test.sd b/config-model/src/test/derived/map_attribute/test.sd index da31f575396..87fc13d48ed 100644 --- a/config-model/src/test/derived/map_attribute/test.sd +++ b/config-model/src/test/derived/map_attribute/test.sd @@ -4,6 +4,7 @@ search test { indexing: summary struct-field key { indexing: attribute + attribute: fast-search } struct-field value { indexing: attribute diff --git a/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg b/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg index 95cf8f761a0..7e38ba06f74 100644 --- a/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg +++ b/config-model/src/test/derived/map_of_struct_attribute/attributes.cfg @@ -3,7 +3,7 @@ attribute[].datatype STRING attribute[].collectiontype ARRAY attribute[].removeifzero false attribute[].createifnonexistent false -attribute[].fastsearch false +attribute[].fastsearch true attribute[].huge false attribute[].sortascending true attribute[].sortfunction UCA @@ -83,7 +83,7 @@ attribute[].datatype STRING attribute[].collectiontype ARRAY attribute[].removeifzero false attribute[].createifnonexistent false -attribute[].fastsearch false +attribute[].fastsearch true attribute[].huge false attribute[].sortascending true attribute[].sortfunction UCA diff --git a/config-model/src/test/derived/map_of_struct_attribute/test.sd b/config-model/src/test/derived/map_of_struct_attribute/test.sd index e139a7f8168..929fa8dcbbe 100644 --- a/config-model/src/test/derived/map_of_struct_attribute/test.sd +++ b/config-model/src/test/derived/map_of_struct_attribute/test.sd @@ -8,6 +8,7 @@ search test { indexing: summary struct-field key { indexing: attribute + attribute: fast-search } struct-field value.name { indexing: attribute @@ -23,6 +24,7 @@ search test { } struct-field value.name { indexing: attribute + attribute: fast-search } } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AttributeListTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AttributeListTestCase.java index bd762c64c00..da28dd56694 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AttributeListTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AttributeListTestCase.java @@ -74,8 +74,8 @@ public class AttributeListTestCase extends SearchDefinitionTestCase { Search search = SearchBuilder.buildFromFile("src/test/derived/array_of_struct_attribute/test.sd"); Iterator<Attribute> attributes = new AttributeFields(search).attributeIterator(); - assertAttribute("elem_array.name", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, attributes.next()); - assertAttribute("elem_array.weight", Attribute.Type.INTEGER, Attribute.CollectionType.ARRAY, attributes.next()); + assertAttribute("elem_array.name", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, true, attributes.next()); + assertAttribute("elem_array.weight", Attribute.Type.INTEGER, Attribute.CollectionType.ARRAY, false, attributes.next()); assertTrue(!attributes.hasNext()); } @@ -84,18 +84,19 @@ public class AttributeListTestCase extends SearchDefinitionTestCase { Search search = SearchBuilder.buildFromFile("src/test/derived/map_of_struct_attribute/test.sd"); Iterator<Attribute> attributes = new AttributeFields(search).attributeIterator(); - assertAttribute("str_elem_map.key", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, attributes.next()); - assertAttribute("str_elem_map.value.name", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, attributes.next()); - assertAttribute("str_elem_map.value.weight", Attribute.Type.INTEGER, Attribute.CollectionType.ARRAY, attributes.next()); - assertAttribute("int_elem_map.key", Attribute.Type.INTEGER, Attribute.CollectionType.ARRAY, attributes.next()); - assertAttribute("int_elem_map.value.name", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, attributes.next()); + assertAttribute("str_elem_map.key", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, true, attributes.next()); + assertAttribute("str_elem_map.value.name", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, false, attributes.next()); + assertAttribute("str_elem_map.value.weight", Attribute.Type.INTEGER, Attribute.CollectionType.ARRAY, false, attributes.next()); + assertAttribute("int_elem_map.key", Attribute.Type.INTEGER, Attribute.CollectionType.ARRAY, false, attributes.next()); + assertAttribute("int_elem_map.value.name", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, true, attributes.next()); assertTrue(!attributes.hasNext()); } - private static void assertAttribute(String name, Attribute.Type type, Attribute.CollectionType collection, Attribute attr) { + private static void assertAttribute(String name, Attribute.Type type, Attribute.CollectionType collection, boolean isFastSearch, Attribute attr) { assertEquals(name, attr.getName()); assertEquals(type, attr.getType()); assertEquals(collection, attr.getCollectionType()); + assertEquals(isFastSearch, attr.isFastSearch()); } @Test @@ -110,7 +111,7 @@ public class AttributeListTestCase extends SearchDefinitionTestCase { "}")).getSearch(); Iterator<Attribute> attributes = new AttributeFields(search).attributeIterator(); - assertAttribute("pos_array_zcurve", Attribute.Type.LONG, Attribute.CollectionType.ARRAY, attributes.next()); + assertAttribute("pos_array_zcurve", Attribute.Type.LONG, Attribute.CollectionType.ARRAY, true, attributes.next()); assertTrue(!attributes.hasNext()); } @@ -119,9 +120,9 @@ public class AttributeListTestCase extends SearchDefinitionTestCase { Search search = SearchBuilder.buildFromFile("src/test/derived/map_attribute/test.sd"); Iterator<Attribute> attributes = new AttributeFields(search).attributeIterator(); - assertAttribute("str_map.key", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, attributes.next()); - assertAttribute("str_map.value", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, attributes.next()); - assertAttribute("int_map.key", Attribute.Type.INTEGER, Attribute.CollectionType.ARRAY, attributes.next()); + assertAttribute("str_map.key", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, true, attributes.next()); + assertAttribute("str_map.value", Attribute.Type.STRING, Attribute.CollectionType.ARRAY, false, attributes.next()); + assertAttribute("int_map.key", Attribute.Type.INTEGER, Attribute.CollectionType.ARRAY, false, attributes.next()); assertTrue(!attributes.hasNext()); } |