diff --git a/docker/include/feature-flags.json b/docker/include/feature-flags.json index 236a55e9d..8a090e2b6 100644 --- a/docker/include/feature-flags.json +++ b/docker/include/feature-flags.json @@ -6,7 +6,8 @@ { "value" : [ "VESPA_BITVECTOR_RANGE_CHECK=true", - "VESPA_ENABLE_PREPARE_RESTART2=true" + "VESPA_ENABLE_PREPARE_RESTART2=true", + "VESPA_ALLOW_ARRAY_OF_BOOL=true" ] } ] diff --git a/tests/search/array_of_bool/array_of_bool.rb b/tests/search/array_of_bool/array_of_bool.rb new file mode 100644 index 000000000..77bacde2b --- /dev/null +++ b/tests/search/array_of_bool/array_of_bool.rb @@ -0,0 +1,34 @@ +require 'indexed_only_search_test' + +class ArrayOfBool < IndexedOnlySearchTest + + def setup + set_owner("havardpe") + set_description("Test support for array field type") + end + + def test_array_of_bool + deploy_app(SearchApp.new.sd(selfdir + "test.sd")) + start + feed_and_wait_for_docs("test", 5, :file => selfdir + "feed.json") + + # verify summary rendering + assert_summary_flags('tft', [true, false, true]) + assert_summary_flags('ff', [false, false]) + assert_summary_flags('tttf', [true, true, true, false]) + assert_summary_flags('empty', nil) + assert_summary_flags('notset', nil) + end + + def assert_summary_flags(title, expected) + result = search({"yql" => "select * from sources * where title contains '#{title}'"}) + puts "title(#{title}) gives result: #{result.xmldata}" + assert_equal(1, result.hitcount) + assert_equal(result.hit[0].field['flags'], expected) + end + + def teardown + stop + end + +end diff --git a/tests/search/array_of_bool/feed.json b/tests/search/array_of_bool/feed.json new file mode 100644 index 000000000..bde24de19 --- /dev/null +++ b/tests/search/array_of_bool/feed.json @@ -0,0 +1,36 @@ +[ + { + "put": "id:test:test::1", + "fields": { + "title": "tft", + "flags": [true, false, true] + } + }, + { + "put": "id:test:test::2", + "fields": { + "title": "ff", + "flags": [false, false] + } + }, + { + "put": "id:test:test::3", + "fields": { + "title": "tttf", + "flags": [true, true, true, false] + } + }, + { + "put": "id:test:test::4", + "fields": { + "title": "empty", + "flags": [] + } + }, + { + "put": "id:test:test::5", + "fields": { + "title": "notset" + } + } +] diff --git a/tests/search/array_of_bool/test.sd b/tests/search/array_of_bool/test.sd new file mode 100644 index 000000000..daa6e6ca0 --- /dev/null +++ b/tests/search/array_of_bool/test.sd @@ -0,0 +1,10 @@ +schema test { + document test { + field title type string { + indexing: summary | index + } + field flags type array { + indexing: summary | attribute + } + } +}