Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docker/include/feature-flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
]
Expand Down
34 changes: 34 additions & 0 deletions tests/search/array_of_bool/array_of_bool.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require 'indexed_only_search_test'

class ArrayOfBool < IndexedOnlySearchTest

def setup
set_owner("havardpe")
set_description("Test support for array<bool> 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
36 changes: 36 additions & 0 deletions tests/search/array_of_bool/feed.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
10 changes: 10 additions & 0 deletions tests/search/array_of_bool/test.sd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
schema test {
document test {
field title type string {
indexing: summary | index
}
field flags type array<bool> {
indexing: summary | attribute
}
}
}