Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the FullTextSearch docs to provide an example of their optionality #25

Merged
merged 2 commits into from
Nov 6, 2024
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use 2 spaces for each indentation level instead of 4? That's what we use for all the other queries and (at least to my eyes) I think it looks a bit cleaner.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely. Fixed in the latest commit, PTAL

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 %}