Reputation: 27
I want to write a GraphQl query in the Orchard with these conditions:
I have a content type for Office and another one for City Now I want to receive all the offices in Newyork city. But the problem is that in the where condition of the GraphQl I don't see any condition for filtering a specific city.
What can I do?
Upvotes: 0
Views: 347
Reputation: 114
You could create a taxonomy for cities and then add a taxonomy field with Cities taxonomy to your Office content type.
Enable Queries Feature, which is a module that enables you to write Lucene or SQL queries and expose them to GraphQL.
Add a SQL query.
{
"type": "ContentItem/Office"
}
TermContentItemId
.
Something along the linesSELECT
ti.DocumentId
FROM
TaxonomyIndex ti
WHERE
ti.TermContentItemId = @cityItemId
AND ti.ContentType = 'Office'
query MyQuery {
getOfficesByCity(parameters: "{\"cityItemId\":\"4rx2d0cqr8h7fyzdq95hb45scj\"}") {
displayText
}
}
Upvotes: 1