Skip to content

Commit

Permalink
Update readme for anyOf and not
Browse files Browse the repository at this point in the history
  • Loading branch information
acerbusace committed Nov 27, 2024
1 parent 7ec7e83 commit 15b174a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[`gt`]({% link query-api/filtering/comparison.md %})
: Matches records where the field value is greater than (>) the provided value.

Will be ignored when `null` is passed.
Will be treated as `true` when `null` is passed.

[`gte`]({% link query-api/filtering/comparison.md %})
: Matches records where the field value is greater than or equal to (>=) the provided value.

Will be ignored when `null` is passed.
Will be treated as `true` when `null` is passed.

[`lt`]({% link query-api/filtering/comparison.md %})
: Matches records where the field value is less than (<) the provided value.

Will be ignored when `null` is passed.
Will be treated as `true` when `null` is passed.

[`lte`]({% link query-api/filtering/comparison.md %})
: Matches records where the field value is less than or equal to (<=) the provided value.

Will be ignored when `null` is passed.
Will be treated as `true` when `null` is passed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
filters that can't be provided on a single filter input because of collisions between key names.
For example, if you want to provide multiple `anySatisfy: ...` filters, you could do `allOf: [{anySatisfy: ...}, {anySatisfy: ...}]`.

Will be ignored when `null` or an empty list is passed.
Will be treated as `true` when `null` or an empty object is passed.
When an empty list is passed, will cause this part of the filter to match no documents.

[`anyOf`]({% link query-api/filtering/conjunctions.md %})
: Matches records where any of the provided sub-filters evaluate to true.
This works just like an `OR` operator in SQL.

Will be ignored when `null` is passed. When an empty list is passed, will
cause this part of the filter to match no documents.
Will be treated as `true` when `null` or an empty object is passed.
When an empty list is passed, will cause this part of the filter to match no documents.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
: Matches records where the field value is equal to any of the provided values.
This works just like an `IN` operator in SQL.

Will be ignored when `null` is passed.
Will be treated as `true` when `null` is passed.
When an empty list is passed, will cause this part of the filter to match no documents.
When `null` is passed in the list, will match records where the field value is `null`.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
full text search. This is stricter than `matchesQuery`: all terms must match
and be in the same order as the provided phrase.

Will be ignored when `null` is passed.
Will be treated as `true` when `null` is passed.

[`matchesQuery`]({% link query-api/filtering/full-text-search.md %})
: Matches records where the field value matches the provided query using full text search.
This is more lenient than `matchesPhrase`: the order of terms is ignored, and, by default,
only one search term is required to be in the field value.

Will be ignored when `null` is passed.
Will be treated as `true` when `null` is passed.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[`anySatisfy`]({% link query-api/filtering/list.md %})
: Matches records where any of the list elements match the provided sub-filter.

Will be ignored when `null` or an empty object is passed.
Will be treated as `true` when `null` or an empty object is passed.

[`count`]({% link query-api/filtering/list.md %})
: Used to filter on the number of non-null elements in this list field.

Will be ignored when `null` or an empty object is passed.
Will be treated as `true` when `null` or an empty object is passed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
: Matches records where the field's geographic location is within a specified distance
from the location identified by `latitude` and `longitude`.

Will be ignored when `null` or an empty object is passed.
Will be treated as `true` when `null` or an empty object is passed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
: Matches records where the provided sub-filter evaluates to false.
This works just like a `NOT` operator in SQL.

Will be ignored when `null` or an empty object is passed.
Will be treated as `false` when `null` or an empty object is passed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[`timeOfDay`]({% link query-api/filtering/date-time.md %})
: Matches records based on the time-of-day of the DateTime values.

Will be ignored when `null` of an empty object is passed.
Will be treated as `true` when `null` or an empty object is passed.
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,16 @@ def new_filter_input_type(source_type, name_prefix: source_type, category: :filt
t.documentation <<~EOS
Input type used to specify filters on `#{source_type}` fields.
Will be ignored if passed as an empty object (or as `null`).
Will be treated as `true` if passed as an empty object (or as `null`).
EOS

t.field @state.schema_elements.any_of, "[#{t.name}!]" do |f|
f.documentation <<~EOS
Matches records where any of the provided sub-filters evaluate to true.
This works just like an OR operator in SQL.
Will be ignored when `null` is passed. When an empty list is passed, will cause this
part of the filter to match no documents.
Will be treated as `true` when `null` or an empty object is passed.
When an empty list is passed, will cause this part of the filter to match no documents.
EOS
end

Expand All @@ -159,7 +159,7 @@ def new_filter_input_type(source_type, name_prefix: source_type, category: :filt
Matches records where the provided sub-filter evaluates to false.
This works just like a NOT operator in SQL.
Will be ignored when `null` or an empty object is passed.
Will be treated as `false` when `null` or an empty object is passed.
EOS
end

Expand Down Expand Up @@ -303,7 +303,7 @@ def new_list_filter_input_type(source_type, name_prefix:, any_satisfy_type_categ
f.documentation <<~EOS
Matches records where any of the list elements match the provided sub-filter.
Will be ignored when `null` or an empty object is passed.
Will be treated as `true` when `null` or an empty object is passed.
EOS
end

Expand All @@ -315,7 +315,8 @@ def new_list_filter_input_type(source_type, name_prefix:, any_satisfy_type_categ
be provided on a single `#{t.name}` input because of collisions between key names. For example, if you want to provide
multiple `#{any_satisfy}: ...` filters, you could do `#{all_of}: [{#{any_satisfy}: ...}, {#{any_satisfy}: ...}]`.
Will be ignored when `null` or an empty list is passed.
Will be treated as `true` when `null` or an empty object is passed.
When an empty list is passed, will cause this part of the filter to match no documents.
EOS
end

Expand All @@ -330,7 +331,7 @@ def new_list_element_filter_input_type(source_type, name_prefix:)
t.documentation <<~EOS
Input type used to specify filters on elements of a `[#{source_type}]` field.
Will be ignored if passed as an empty object (or as `null`).
Will be treated as `true` if passed as an empty object (or as `null`).
EOS

# While we support `not: {any_satisfy: ...}` we do not support `any_satisfy: {not ...}` at this time.
Expand Down Expand Up @@ -374,7 +375,7 @@ def new_fields_list_filter_input_type(source_type_name, name_prefix:)
or transitively from a list field that has been configured to index each leaf field as
its own flattened list of values.
Will be ignored if passed as an empty object (or as `null`).
Will be treated as `true` if passed as an empty object (or as `null`).
EOS

source_type.graphql_fields_by_name.each do |field_name, field|
Expand Down Expand Up @@ -424,7 +425,7 @@ def define_list_counts_filter_field_on(type)
f.documentation <<~EOS
Used to filter on the number of non-null elements in this list field.
Will be ignored when `null` or an empty object is passed.
Will be treated as `true` when `null` or an empty object is passed.
EOS
end
end
Expand Down

0 comments on commit 15b174a

Please sign in to comment.