Skip to content

Commit

Permalink
Cover time_of_day filtering in search_index_expression_spec.rb.
Browse files Browse the repository at this point in the history
This was a gap in our test coverage.
  • Loading branch information
myronmarston committed Dec 8, 2024
1 parent a822b1d commit 53acfad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,30 @@ class GraphQL
end
end

context "when `time_of_day` filtering is used" do
it "targets all indices since it filters only on the time but rollover uses full DateTime values" do
parts = search_index_expression_parts_for({"created_at" => {
"time_of_day" => {"gt" => "12:30:00Z"}
}})

expect(parts).to target_all_widget_indices
end

it "targets all indices when it is negated since matching documents could live in any index" do
parts = search_index_expression_parts_for({"created_at" => {
"not" => {"time_of_day" => {"gt" => "12:30:00Z"}}
}})

expect(parts).to target_all_widget_indices

parts = search_index_expression_parts_for({"not" => {
"created_at" => {"time_of_day" => {"gt" => "12:30:00Z"}}
}})

expect(parts).to target_all_widget_indices
end
end

context "when `not` is used" do
it "excludes indices targeted by a filter without both an upper and lower bound" do
parts = search_index_expression_parts_for({"created_at" => {"not" => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def shard_routing_for(route_with_field_paths, filter_or_filters)
})).to search_all_shards
end

it "searches all shards when set to nil`" do
it "searches all shards when set to nil" do
expect(shard_routing_for(["name"], {
"name" => {"not" => nil}
})).to search_all_shards
Expand Down

0 comments on commit 53acfad

Please sign in to comment.