Filtering
Filtering is a technique that allows for the selection and extraction of data from a large dataset based on specified criteria.
Number of adults and children
To filter search results based on the number of adults, you should use the adults
filter. If you want filters results based on number of children you have to also use children
and then childrenBirthDate
field which have to enter birth date of each child.
The following search
query returns offers and term for a configuration of 2 adults and 2 children. It retrieves prices
for each person and pesonsConfiguration
.
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
adults:2
children:2
childrenBirthDates:["2021-09-04", "2021-09-04"]
}
) {
offers {
id
terms {
id
personsConfiguration {
children
foundAdults
foundChildren
foundChildrenAges
foundChildrenBirthDates
}
totalPrice
personPrices {
price
type
}
}
}
}
}
Sample output from executing the graphql query above:
{
"data": {
"search": {
"offers": [
{
"id": "169",
"terms": [
{
"id": "0013f179ce7570476953a2321605364b",
"personsConfiguration": {
"children": 2,
"foundAdults": 2,
"foundChildren": 2,
"foundChildrenAges": [
3,
3
],
"foundChildrenBirthDates": [
"2021-09-04",
"2021-09-04"
]
},
"totalPrice": 17600,
"personPrices": [
{
"price": 5500,
"type": "ADULT"
},
{
"price": 5500,
"type": "ADULT"
},
{
"price": 3300,
"type": "CHILD"
},
{
"price": 3300,
"type": "CHILD"
}
]
}
]
}
]
}
}
}
Filter by dates
If you want to filter data based on departure dates, you can use the departureDate
filter.
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
departureDate: {min: "2024-10-01", max: "2024-10-31"}
}
){
count
}
}
Filter by destination
If you want filter data based on destination you are able to use countrySourceName
, regionSourceName
or citySourceName
field.
You can also filter by destination id
: countrySourceId
, regionSourceId
or citySourceId
.
Country
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
countrySourceName: ["Grecja", "Turcja"]
}
){
count
}
}
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
countrySourceId: ["GR", "TR"]
}
){
count
}
}
Region
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
regionSourceName: ["Rodos", "Alanya"]
}
){
count
}
}
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
regionSourceId: ["5", "6"]
}
){
count
}
}
City
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
citySourceName: ["Okurcalar", "Alanya", "Rodos"]
}
){
count
}
}
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
citySourceId: ["1001", "1002", "1003"]
}
){
count
}
}
Filter by offer type
If you want to filter data based on offer type, you can use the offerType
filter.
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
offerType: ["Wypoczynek", "Narty"]
}
){
count
}
}
Filter by property category
If you want to filter data by property category, you can use filters: propertyCategoryRange
for filtering in specific category range or propertyCategory
and propertySourceCategory
filter by specific category.
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
propertyCategoryRange: {min: 30, max: 50 }
}
){
count
}
}
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
propertyCategory: ["30", "40"]
}
){
count
}
}
Filter by transport type
If you want to filter data based on transport type, you can use the transportType
filter.
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
transportType: ["samolot", "własny"]
}
){
count
}
}
Filter by departure city
If you want to filter data based on departure city, you can use the departureCity
filter.
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
departureCity: ["Kraków", "Gdańsk"]
}
){
count
}
}
Filter by period
For filtering results within a specific range period, use the period
filter.
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
period: {min: 7, max: 14 }
}
){
count
}
}
Filter by maintenances
If you want to filter data based on meals, you can use the maintenanceSourceName
, maintenanceName
, maintenancSourceCode
, maintenanceCode
filter.
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
maintenanceSourceName: ["Śniadania i obiadokolacje", "Ultra All Inclusive"]
}
){
count
}
}
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
maintenanceName: ["Śniadania i obiadokolacje", "All Inclusive"]
}
){
count
}
}
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
maintenanceSourceCode: ["BB", "UAI"]
}
){
count
}
}
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
maintenanceCode: ["BB", "HB", "AI"]
}
){
count
}
}
Filter by room properties
If you want to filter data based on room properties, you can use the roomSourceName
, roomName
, roomSourceCode
, roomCode
filter.
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
roomSourceName: ["Pokój jednoosobowy", "Apartament", "2-osobowy z łazienką"]
}
){
count
}
}
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
roomName: ["Apartament", "Suite"]
}
){
count
}
}
Filter by prices
For filtering results within a specific price, use the price
filter.
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
price: {min: 1000, max: 8000}
}
){
count
}
}
Filter by offers id
If you want to filter data based on offer id, you can use the offerIds
filter.
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
offerIds: ["177", "167"]
}
){
count
}
}
Filter by semantic categories
If you want to filter data based on sematic categories, you can use the semanticCategoryAccommodation
,semanticCategoryActivity
, semanticCategoryBoardType
, semanticCategoryHotelAmenities
, semanticCategoryHotelAttractions
,semanticCategoryOfferType
, semanticCategoryRoomType
, semanticCategoryTransportation
, semanticCategoryTripAttractions
filters.
Filters search results by accomodation
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
semanticCategoryAccommodation: ["hotel"]
}
) {
count
}
}
Filters search results by activity
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
semanticCategoryActivity: ["sporty wodne"]
}
) {
count
}
}
Filters search results by board type
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
semanticCategoryBoardType: ["ultra all inclusive"]
}
) {
count
}
}
Filters search results by hotel amenities
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
semanticCategoryHotelAmenities: ["opieka dla dzieci"]
}
) {
count
}
}
Filters search results by hotel attractions
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
semanticCategoryHotelAttractions: ["park wodny"]
}
) {
count
}
}
Filters search results by offer type
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
semanticCategoryOfferType: ["wypoczynek"]
}
) {
count
}
}
Filters search results by room type
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
semanticCategoryRoomType: ["suite"]
}
) {
count
}
}
Filters search results by transportation
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
semanticCategoryTransportation: ["samolot"]
}
) {
count
}
}
Filters search results by trip atractions
query {
search (
countryCode: PL,
languageCode: PL,
filters: {
semanticCategoryTripAttractions: ["plac zabaw"]
}
) {
count
}
}
You can explore the available filter options and other fields on our Demo Search Playground. Visit the Docs tab for detailed information on these options.