Is there a simple way to query partial matching st...
# prisma-whats-new
m
Is there a simple way to query partial matching string fields? something like ` { title: LIKE "%" + $userInput + "%" }
n
@mike.johnson you can use the
title_contains
filter:
Copy code
query {
  allPosts(filter: {
    title_contains: $userInput
  }) {
    id
  }
}
m
and that would partial match on both sides? ie: query for "atm" would return "Batman"?
a
description: String description_not: String description_in: [String!] description_not_in: [String!] description_lt: String description_lte: String description_gt: String description_gte: String description_contains: String description_not_contains: String description_starts_with: String description_not_starts_with: String description_ends_with: String description_not_ends_with: String
That's all for String fields
m
does contains match both sides of the $userInput?
a
Yes, otherwise it would be starts_with or ends_with
So contains does both sides
m
Right, graph.cool it is then. I asked this same question to scaphold.io's slack yesterday and no replies. in fact almost no activity on the entire channel. Ask here and get 2 people replying in minutes 🙂
graphcool 3
a
Good choice m8 🙂
Someone (@nilan?) should make a cheat sheet for the filter options on the different field types... 😉
n
We're on it! 😄
👍🏻 1
a
closes Photoshop
n
why Photoshop? 🤔
a
Because I love visual cheat sheets, and it's my goto tool for DTP
n
ah
My aim for that article wasn't a visual cheatsheet but rather a textual representation
@mike.johnson if you want to play around with available filters, you can use these interactive playgrounds: https://www.graph.cool/docs/tutorials/designing-powerful-apis-with-graphql-query-parameters-aing7uech3/
it's setup against a Graphcool project with some movie/actor data