Create Query Pipelines
Mohamed Sirajudeen
Senior Sitecore Consultant at INSCALE |??2x Sitecore Technology MVP |??4x Sitecore? Certified |??AI Enthusiast |???Blogger |???Speaker
When you created the basic search by using Coveo in Sitecore, I hope everyone will be comfortable to use the default query pipelines in the Search Interface. When you create the multiple Search Interface, you can take an advantage of query pipelines and can apply different rules or models for each Search Interface.
What is Query Pipeline? Why we needed ? There are so many questions in our mind, this is the article where I am going to answer all the possible questions.
Query Pipeline is a set of rules or model association that can be defined to modify queries.
Query Pipeline rules can define :
1. Search terms
2. Result rankings
3. Groups & campaigns
4. Advance query pipeline rules
we can also use query pipeline A/B Testing to evaluate rule or model changes on a part of the users.
You can define query pipelines from the Coveo Administration Console.
1. When you go to Coveo Administration tool, Go to Search Section ==> Query Pipelines, you can see default query pipeline was already created.
2. Create new query pipeline by clicking "Add Pipeline" button.
3. It will open the popup to enter the basic information. It has two tabs (Configuration & Access)
Pipeline name - Name of the pipeline
we have to choose Use-case from the dropdown options.
Condition can select later after creating the pipeline or we can create new condition. Interface URL (optional field) should be specific page and related content to search.
In the Access Tab, we can see the what kind of group access have assigned for.
Also we can see the API Key configuration access as well.
4. I am going to create new query pipeline with below information entered.
5. When I click "Add Pipeline", It will create new query pipeline.
Newly created query pipeline will show here.
6. Click newly created query pipeline and "Edit Components".
7. When you click "Edit Components", It will open the below page.
Note : As you see there are lot of options to create 100% efficient search results. we have an options to create Query Suggestion Model, Automatic Relevance Tuning Model (Machine Learning) & basic condition.
Before we create basic configuration, we will see what are all the options available.
8. Groups & Campaigns :
This section of a query pipeline configuration allows to create sets of query pipeline "Result Ranking" rules that apply for specific contexts, audiences or period of time.
when you click "Add group", It will redirected to the below popup.
Click "Take me there", It will take you to the "Result Ranking" section. we will see this section later in this article.
If you click "Not now", created group gets "Activated" and show it like below.
9. Search Terms:
There are two below sections in Search Terms.
·?????Thesaurus
·?????Stop words
Thesaurus:
It is a list of equivalent words used to add keywords or phrases to the query entered by a user before it's sent to Index.
Example:
Condition: Query contains training
Rule: Include Virtual Training, In Person training when any are present.
When we click "Add Rule" in Thesaurus section, you will see the below content.
领英推荐
Synonym - we should define more meaningful terms in the first position of the statement to avoid relevance issues.
One-way synonym - If we want to add any additional prefix or postfix. For Ex : If user search for number "1008" means one way synonym can add four 0's in prefix by using the rule "00001008".
Replace - If we want any text to be replaced entirely. For Ex: If user search for text "Nice", we can replace it by "Awesome".
Match Terms Exactly - When you only specify Original expressions, the specified expressions are turned into their corresponding exact phrase match expression. For Ex: If user search for "Sachin Tendulkar, we can use match expression like "God of Cricket" or "Master Blaster".
Stop words :
Stop words are the words that are filtered out from a query before it's sent to the Index. For Ex : in, for, how are the stop words. If user search for "in the plan for year 2023" means, stop words are removed before sent it to index.
When you add stop words it will look like the below image.
10. Result ranking :
This section allows members to manage featured result and ranking expression of query pipeline rules.
When we click "Add Rule", there will be two below options to select.
If we click "Ranking expression", it will open the below content. Then we must enter the condition to boost the search results.
For Ex: Take an example of above image, In the basic mode I've chosen the rule, if the title field value is "item3", then boost this expression by 300+ so that it will show in the top of the search results.
If we click "Featured Result", it will open the below content.
Click "Add indexed items".
It will open the below popup.
Click "Add a query expression".
Start writing query, then the result will come as per the query.
Click "Add Items" and save.
when you double click the created "Result ranking", then you will see the featured item in the top.
11. Machine Learning :
Once a machine learning model has collected sufficient interaction data, associate it with a query pipeline to enrich your search interfaces with AI.
When we click "Associate Model", we have number of options to collect and tuning the search results.
12. Let's apply basic query in demo to retrieve the results in Sitecore.
Go to Sitecore content editor ==> Coveo Global Parameters Folder ==> Global Search Interfaces ==> Coveo Search Interface
change the "Query pipeline" to newly created query pipeline "site".
Go to parent node of the search item and copy the item ID.
Go to Coveo Administration Console ==> Query Pipelines ==> site ==> double click ==> Go to Advanced Tab ==> Click "Add Rule"
we must select Query parameter as "advanced query".
we must choose a field as "z95xpath", comparator as "Is" & field value?as "{Item ID ==> without hyphen in GUID}". For Ex ==> If Item ID is {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} means field value should be "110D559FDEA542EA9C1C8A5DF7E70EF9".
Click "Add Rule".
Go to Indexing Manager and Index the items. you will see the result based on the xpath item and its sub items (search relevance tuning).
See, we already set "item2" as featured item, that's the reason it is showing in the top of the result.
If we have multiple pages, we can create multiple query pipeline to fetch the related search results for each single page. It will obviously improve the performance.
That's the end of this Article.
I hope this information will help to create query pipelines and tune the search results as per the rules.
Happy Sitecoring!