Skip to main content

Pin Item

The Pin Item rule, along with the tool for organizing search results according to business objectives, allows for the management of offer visibility based on query filters or keywords. This functionality can be easily accessed and managed directly from the Dashboard Search, providing a streamlined way to configure and control how specific offers are displayed based on predefined criteria.

Show available rulres

Fetches a list of available rules used for pinning specific offers in the system. Each rule contains details such as name, description, configuration, and status.

Try the Qtravel Search & Discovery Platform for free

You can explore on Qtravel Serch Developer how it works with example data. Sign up or, if you have an account, just log in.

  query Rules {
rules(type: PinItemRule) {
config
createdAt
description
endDate
id
name
startDate
status
type
updatedAt
}
}

Example Response

{
"data": {
"rules": [
{
"config": {
"offers": [
"55"
],
"triggers": {
"query": {
"query": "all inclusive",
"matcher": "contains"
}
}
},
"createdAt": "2024-09-05",
"description": "A rule that moves offer IDs 1, 2, and 3 higher in the results after entering the 'All inclusive' query.",
"endDate": "2024-10-01",
"id": "3",
"name": "All Inclusive",
"startDate": "2024-09-01",
"status": "draft",
"type": "PinItemRule",
"updatedAt": "2024-09-05"
},
{
"config": {
"offers": [
"1",
"2",
"3"
],
"triggers": {
"query": {
"query": "123",
"matcher": "equals"
}
}
},
"createdAt": "2024-09-05",
"description": null,
"endDate": "2024-10-01",
"id": "1",
"name": "All Inclusive extra2",
"startDate": "2024-09-01",
"status": "cancelled",
"type": "PinItemRule",
"updatedAt": "2024-09-23"
} ...

}

Display single rule

Retrieves details of a single rule based on its unique identifier (ID).

 query {
rule(id: 3, type: PinItemRule ) {
config
createdAt
description
endDate
id
name
startDate
status
type
updatedAt
}
}

Response for single rule

{
"data": {
"rule": {
"config": {
"offers": [
"55"
],
"triggers": {
"query": {
"query": "all inclusive",
"matcher": "contains"
}
}
},
"createdAt": "2024-09-05",
"description": "Test1234",
"endDate": "2024-10-01",
"id": "3",
"name": "All Inclusive",
"startDate": "2024-09-01",
"status": "draft",
"type": "PinItemRule",
"updatedAt": "2024-09-05"
}
}
}

Add new rule

Creates a new rule by specifying its name, offers, status, and triggering criteria.

mutation {
addPinItemRule(
dates: { start: "2024-09-01", end: "2024-10-01" }
name: "All Inclusive"
offers: [1, 2, 3]
status: draft
triggers: { query: { query: "all inclusive", matcher: contains } }
) {
rule {
id
}
}
}

What does the code above mean?

The query creates a rule named All Inclusive, which pins the offers specified in the offers array [1, 2, 3] in the defined order. The rule is active within the date range from September 1, 2024, to October 1, 2024. The rule's status is set to draft, meaning it is saved as a draft and is not active in the production environment. The trigger for the rule is the query all inclusive, which matches results containing this phrase according to the condition: matcher: contains. This rule allows precise management of offer visibility in search results.

Update rule

Updates an existing rule, modifying its status, configuration, or other attributes.

mutation {
updatePinItemRule(
id: 1
status: published
triggers: { filters: { adults: 2 }, query: null }
) {
rule {
id
}
}
}

Delete rule

Deletes an existing rule from the system based on its unique identifier (ID).

 mutation {
deletePinItemRule(id: 3) {
rule {
id
}
}
}