
To search items in Sitecore you can use Graphql search query. It uses where conditions which can have AND and OR operators on any fields in an item.
See below examples for using search query.
I have following list of items in Sitecore-

I want to search by ProductId. This item has only one version.

Use below search query-
query SearchQuery($pageSize: Int = 10, ) {
search(
where: {
AND: [
{
name: "_path"
value: "{B08684BB-3CB0-4DFE-A378-054E26ECC5AE}"
operator: CONTAINS
}
{ name: "ProductId", value: "bali-power-bank-3000mah" }
]
}
first: $pageSize
) {
total
results {
id
name
version
url {
path
}
... on Product{
productId{value}
productFeature{value}
}
}
}
}
We used the where condition with the AND operator.
AND operator has _path and ProductId for searching a secific product or a list of products matching the search criteria.
Here the value of _path is the folder/path where you want to make the query. It is always good to provide the path to increase the performance of search.
ProductId is the field in item to search on. You can also apply more filters here, for example template you want to search.
Output of the above query-
{
"data": {
"search": {
"total": 1,
"results": [
{
"id": "8716FE4AD58345589AB04369C39F5CC0",
"name": "bali-power-bank-3000mah",
"version": 1,
"url": {
"path": "/Data/Commerce-Data/Product-Data/bali-power-bank-3000mah"
},
"productId": {
"value": "bali-power-bank-3000mah"
},
"productFeature": {
"value": "official-camera - Product Feature. JIGA power bank is a high-quality battery pack, with all-day powerThe power bank can charge your phone at least 3-5 times,the perfect partner for gamers, camping and business trips."
}
}
]
}
}
}
![]()




