Skip to content

Commit

Permalink
Update the FullTextSearch docs to provide an example of their optiona…
Browse files Browse the repository at this point in the history
…lity (#25)

* Update the FullTextSearch docs to provide an example of their optionality

In order to ignore a `matchesQuery` or `matchesPhrase` filter predicate, you can supply `null` to the `MatchesQueryFilterInput` or `MatchesQueryFilterInput` types, respectively. However, this is not entirely clear from the docs, as they describe supplying `null`, but not to which field/value. This documentation update aims to make that more clear, and provides an example to highlight the ability to use a null-able variable with these predicates.

## Tested
Ran the site locally. Here are the screenshots of updates:

* update PR with suggestions from comments, including:
* Remove the language around "ignoring" filters
* Revert the changes to the high-level fulltext.md file
* Alter the example query to use 2 spaces instead of 4-space tabs
  • Loading branch information
mattcarp21 authored Nov 6, 2024
1 parent c0c4e55 commit fd87ea9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
query OptionalMatchingFilter(
$optionalMatchQuery: MatchesQueryFilterInput = null
) {
artists(filter: {
bio: {
description: {
matchesQuery: $optionalMatchQuery
}
}
}) {
nodes {
name
bio {
description
}
}
}
}
8 changes: 8 additions & 0 deletions config/site/src/query-api/filtering/full-text-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ are supported to control both aspects to make matching stricter:
{% highlight graphql %}
{{ site.data.music_queries.filtering.PhraseSearch }}
{% endhighlight %}

### Bypassing matchesPhrase and matchesQuery

In order to make a `matchesPhrase` or `matchesQuery` filter optional, you can supply `null` to the `MatchesQueryFilterInput` parameter, like this:

{% highlight graphql %}
{{ site.data.music_queries.filtering.OptionalMatchingFilter }}
{% endhighlight %}

0 comments on commit fd87ea9

Please sign in to comment.