diff --git a/elasticgraph-graphql/spec/acceptance/search_spec.rb b/elasticgraph-graphql/spec/acceptance/search_spec.rb index 468ce4a6..fcf9d5cd 100644 --- a/elasticgraph-graphql/spec/acceptance/search_spec.rb +++ b/elasticgraph-graphql/spec/acceptance/search_spec.rb @@ -181,7 +181,7 @@ module ElasticGraph string_hash_of(widget1, :id, :amount_cents) ]) - # Verify that we can filter on `DateTime` fields (and that `nil` DateTime filter values are ignored) + # Verify that we can filter on `DateTime` fields (and that `nil` DateTime filter values are pruned treating them as `true`) widgets = list_widgets_with(:created_at, filter: {created_at: {gte: "2019-07-02T12:00:00Z", lt: nil}}, order_by: [:created_at_ASC]) @@ -229,7 +229,7 @@ module ElasticGraph string_hash_of(widget2, :id, created_at: "2019-07-02T12:00:00.000Z") ]) - # Verify that we can filter on `Date` fields (and that `nil` Date filter values are ignored) + # Verify that we can filter on `Date` fields (and that `nil` Date filter values are pruned treating them as `true`) widgets = list_widgets_with(:created_on, filter: {created_on: {lte: "2019-07-02", gte: nil}}, order_by: [:created_on_ASC]) diff --git a/elasticgraph-graphql/spec/integration/elastic_graph/graphql/datastore_query/filtering_spec.rb b/elasticgraph-graphql/spec/integration/elastic_graph/graphql/datastore_query/filtering_spec.rb index 6e828f2f..e9f64415 100644 --- a/elasticgraph-graphql/spec/integration/elastic_graph/graphql/datastore_query/filtering_spec.rb +++ b/elasticgraph-graphql/spec/integration/elastic_graph/graphql/datastore_query/filtering_spec.rb @@ -283,7 +283,7 @@ def search_datastore(**options, &before_msearch) expect(results).to match_array(ids_of(team2)) end - it "correctly ignores nil filters under `any_satisfy`" do + it "correctly prunes nil filters under `any_satisfy` treating them as `true`" do results = search_with_filter("current_players_nested", "any_satisfy", { "name" => {"equal_to_any_of" => nil}, "nicknames" => {"any_satisfy" => {"equal_to_any_of" => nil}} @@ -1220,7 +1220,7 @@ def search_datastore(**options, &before_msearch) expect(inner_not_result3).to eq(outer_not_result3).and eq [] end - it "is ignored when set to nil inside `any_of`" do + it "is pruned when set to nil inside `any_of` treating it as `true`" do index_into( graphql, widget1 = build(:widget, amount_cents: 100), diff --git a/elasticgraph-graphql/spec/integration/elastic_graph/graphql/datastore_query/sub_aggregations_spec.rb b/elasticgraph-graphql/spec/integration/elastic_graph/graphql/datastore_query/sub_aggregations_spec.rb index 5d3c30db..d0c6800c 100644 --- a/elasticgraph-graphql/spec/integration/elastic_graph/graphql/datastore_query/sub_aggregations_spec.rb +++ b/elasticgraph-graphql/spec/integration/elastic_graph/graphql/datastore_query/sub_aggregations_spec.rb @@ -193,7 +193,7 @@ class GraphQL }] end - it "ignores empty filters" do + it "prunes empty filters treating them as `true`" do query = aggregation_query_of(name: "teams", sub_aggregations: [ nested_sub_aggregation_of(path_in_index: ["current_players_nested"], query: sub_aggregation_query_of(name: "current_players_nested", filter: { "name" => {"equal_to_any_of" => nil} diff --git a/elasticgraph-graphql/spec/unit/elastic_graph/graphql/aggregation/resolvers/ungrouped_sub_aggregation_shared_examples.rb b/elasticgraph-graphql/spec/unit/elastic_graph/graphql/aggregation/resolvers/ungrouped_sub_aggregation_shared_examples.rb index 37099037..06ac729b 100644 --- a/elasticgraph-graphql/spec/unit/elastic_graph/graphql/aggregation/resolvers/ungrouped_sub_aggregation_shared_examples.rb +++ b/elasticgraph-graphql/spec/unit/elastic_graph/graphql/aggregation/resolvers/ungrouped_sub_aggregation_shared_examples.rb @@ -253,7 +253,7 @@ module Aggregation }] end - it "ignores an empty filter" do + it "prunes an empty filter treating it as `true`" do aggs = { "target:seasons_nested" => {"doc_count" => 423, "meta" => outer_meta} } diff --git a/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/filtering_spec.rb b/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/filtering_spec.rb index 7d48fa36..602c2276 100644 --- a/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/filtering_spec.rb +++ b/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/filtering_spec.rb @@ -378,13 +378,13 @@ class GraphQL ]}}) end - it "is ignored when `null` is passed" do + it "is pruned when `null` is passed treating it as `true`" do query = new_query(filter: {"tags" => {"all_of" => nil}}) expect(datastore_body_of(query)).to not_filter_datastore_at_all end - it "is ignored when `[]` is passed" do + it "is pruned when `[]` is passed treating it as `true`" do query = new_query(filter: {"tags" => {"all_of" => []}}) expect(datastore_body_of(query)).to not_filter_datastore_at_all @@ -786,7 +786,7 @@ class GraphQL }) end - it "ignores `count` filter predicates that have a `nil` or `{}` value" do + it "prunes `count` filter predicates that have a `nil` or `{}` value treating it as `true`" do query = new_query(filter: {"past_names" => {LIST_COUNTS_FIELD => nil}}) expect(datastore_body_of(query)).to not_filter_datastore_at_all diff --git a/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/search_index_expression_spec.rb b/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/search_index_expression_spec.rb index ad3260eb..53c9fabc 100644 --- a/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/search_index_expression_spec.rb +++ b/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/search_index_expression_spec.rb @@ -170,7 +170,7 @@ class GraphQL expect(parts).to eq [] end - it "ignores `nil` when `equal_to_any_of` includes `nil` with other timestamps" do + it "prunes `nil` when `equal_to_any_of` includes `nil` with other timestamps treating it as `true`" do parts = search_index_expression_parts_for({"created_at" => {"equal_to_any_of" => [ "2021-01-15T12:30:00Z", nil, @@ -325,7 +325,7 @@ class GraphQL end %w[equal_to_any_of gt gte lt lte any_of].each do |operator| - it "ignores a `nil` value for a `#{operator}` filter" do + it "prunes a `nil` value for a `#{operator}` filter treating it as `true`" do parts = search_index_expression_parts_for({"created_at" => {operator => nil}}) expect(parts).to target_all_widget_indices diff --git a/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/sub_aggregations_spec.rb b/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/sub_aggregations_spec.rb index bd093b57..3c0b1f78 100644 --- a/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/sub_aggregations_spec.rb +++ b/elasticgraph-graphql/spec/unit/elastic_graph/graphql/datastore_query/sub_aggregations_spec.rb @@ -178,7 +178,7 @@ def self.grouped_field_from(agg_hash) }) end - it "ignores empty filters" do + it "prunes empty filters treating them as `true`" do query = new_query(aggregations: [aggregation_query_of(name: "teams", sub_aggregations: [ nested_sub_aggregation_of(path_in_index: ["current_players_nested"], query: sub_aggregation_query_of(name: "current_players_nested", filter: { "name" => {"equal_to_any_of" => nil} diff --git a/elasticgraph-graphql/spec/unit/elastic_graph/graphql/query_adapter/filters_spec.rb b/elasticgraph-graphql/spec/unit/elastic_graph/graphql/query_adapter/filters_spec.rb index 6e75b556..fcdd6158 100644 --- a/elasticgraph-graphql/spec/unit/elastic_graph/graphql/query_adapter/filters_spec.rb +++ b/elasticgraph-graphql/spec/unit/elastic_graph/graphql/query_adapter/filters_spec.rb @@ -533,7 +533,7 @@ class QueryAdapter end describe "`null` leaves" do - it "ignores `filter: null`" do + it "prunes `filter: null` treating it as true" do query = datastore_query_for(:Query, :components, <<~QUERY) query { components(filter: null) { @@ -547,7 +547,7 @@ class QueryAdapter expect(query.filters).to contain_exactly(exclude_incomplete_docs_filter) end - it "ignores a `field: null` filter since it will get pruned" do + it "prunes `field: null` filter treating it as `true`" do query = datastore_query_for(:Query, :components, <<~QUERY) query { components(filter: {cost: null}) { @@ -579,7 +579,7 @@ class QueryAdapter expect(query.filters).to contain_exactly({"cost" => nil, "name" => {"equal_to_any_of" => ["thingy"]}}) end - it "ignores a `field: {predicate: null}` filter since it will get pruned" do + it "prunes `field: {predicate: null}` filter treating it as `true`" do query = datastore_query_for(:Query, :components, <<~QUERY) query { components(filter: {cost: {equal_to_any_of: null}}) { @@ -614,7 +614,7 @@ class QueryAdapter }) end - it "ignores a `null` filter since it will get pruned" do + it "prunes `null` filter treating it as `true`" do query = datastore_query_for(:Query, :components, <<~QUERY) query { components(filter: {options: null}) { @@ -649,7 +649,7 @@ class QueryAdapter }) end - it "ignores a `parent_field: {child_field: null}` filter since it will get pruned" do + it "prunes `parent_field: {child_field: null}` filter treating it as true" do query = datastore_query_for(:Query, :components, <<~QUERY) query { components(filter: {options: {size: null}}) { @@ -684,7 +684,7 @@ class QueryAdapter }) end - it "ignores a `parent_field: {child_field: {predicate: null}}` filter since it will get pruned" do + it "prunes `parent_field: {child_field: {predicate: null}}` filter treating it as true" do query = datastore_query_for(:Query, :components, <<~QUERY) query { components(filter: {options: {size: {equal_to_any_of: null}}}) { @@ -932,7 +932,7 @@ class QueryAdapter ) end - it "includes the incomplete doc exclusion filter when there are no sub-clauses, because the filter is ignored" do + it "includes the incomplete doc exclusion filter when there are no sub-clauses, because the filter is treated as `false` for being empty" do query = datastore_query_for(:Query, :components, <<~QUERY) query { components(filter: {any_of: []}) {