Iām trying to query the GraphQL api to find any record of certain types that match a certain filter.
Two common example cases:
Case 1: Search by slug
I know the āslugā of a page/record, but I donāt know its modelType, how can I query the GraphQL api to find any record that has that slug? (this can happen if you have a āpagesā record type, but you also have special unique pages record types, like landingPages, or aboutPage, or contactPage).
Case 2: Search by category
I have a Category, and Articles OR Projects could have that category. How could I search for any Article or Project that has Category X? Searching them separately isnāt a good option, because sorting and pagination would be thrown off. My expectations is something like the current Modular Content Fields, using ... on Project {}
and similarly on the category search, except you need to get the category ID first. We cannot do ādeep filteringā right now and thereās a feature request for that. Please vote that or comment if you have more ideas.
Hi @mat_jack1!
Thank you. I think that would be helpful in some cases!
For the Category search case though, having them split into two queries would mean that paginating and sorting wouldnāt really be possible.
And building a custom site search would also be hard without mixed type queries (I know there is the Site Search widget here https://www.datocms.com/docs/guides/installing-site-search/widget which would probably work for a lot of cases, but if you want to make a search that shows more things like images or certain props, or a search that has more capabilities I guess it would need to be filtered by type first)
Great work on the CMS by the way It is probably one of the friendliest UIās and really the best suited to making websites Iāve seen so far.
I see what you are saying, yes, that meta option would be useful.
Iāve noted that down internally and weāll discuss that on the next development iteration. Cannot say right now if we are going to pick that up. If you want to publicly track that you can open a feature request maybe
no @rislam we didnāt get any feature request in the end, so we didnāt consider this feature very requested. Please open one if you want, thank you!