-
Notifications
You must be signed in to change notification settings - Fork 85
GraphQL Search
Theo Mendes edited this page Oct 25, 2021
·
8 revisions
# Sem filtro
query {
# Sort: PRICE, SCORE
# Sort Order: ASC, DESC
search(q: "Rio de Janeiro", pagination: { limit: 20, page: 1, sort: PRICE, sortOrder: ASC })
}
# Com filtro
query {
# Sort: PRICE, SCORE
# Sort Order: ASC, DESC
search(q: "Rio de Janeiro", pagination: { limit: 20, page: 1, sort: PRICE, sortOrder: ASC }, filters: {
# Nome do filtro é o mesmo do retorno; cities, productType ...
productType: {
values: ["product_type_hospedagem", "product_type_hotel"]
# Operador pode ser; OR, AND, NOT
operator: OR
}
cities: {
values: ["city_rio_de_janeiro", "city_paraty"]
# Operador pode ser; OR, AND, NOT
operator: OR
}
})
}
query {
search(q: "Rio de Janeiro", pagination: { limit: 20, page: 1, sort: PRICE, sortOrder: DESC }) {
pagination {
count
current
hasNext
}
filters {
productType {
label
filter
count
}
cities {
label
filter
count
}
stars {
label
filter
count
}
prices {
min
maxExclusive
filter
count
}
}
meta {
count
countWithAvailability
countHotel
countTicket
countPackage
}
results {
id
sku
name
url
category
description
smallDescription
isAvailable
price {
currency
amount
originalAmount
taxes {
originalAmount
originalCurrency
}
}
address {
city
state
country
geoLocation {
lat
lon
}
}
tags {
label
slug
}
gallery(limit: 10) {
# Quality: LOW, MEDIUM, HIGH
# Resolution: LOW, LOWER, ORIGINAL
url(quality: HIGH, resolution: ORIGINAL)
description
}
amenities(limit: 10) {
name
category
}
}
}
}