Search Queries Explained – A Deep Dive into Query Rules, Query Variables and Search Orchestration

20

description

The query framework of SharePoint 2013 is a vast one, and it takes time to learn and master. In this session, you will get an overview of the latent capabilities with query rules and learn how you can maximize the use of query rules when building search driven pages using the Content by Search web part. The session is built around my blog series “SharePoint Search Queries Explained” http://techmikael.blogspot.com/2014/03/sharepoint-search-queries-explained.html

Transcript of Search Queries Explained – A Deep Dive into Query Rules, Query Variables and Search Orchestration

Search Queries Explained

Mikael Svenson – Principal Consultant

@mikaelsvenson – [email protected] – techmikael.blogspot.com

Dev by day – Super Hero by Night

with great power comes great responsibility

I will not cover

• Managed property weights

• Full-text indexes in detail

• Custom rank profiles

• Graph Query Language (GQL v1)

I will cover

• Overview of components involved in a search page

• Crawled and Managed Properties

• Keyword Query Language (KQL)

• FAST Query Language (FQL)

• Result Sources

• Query Variables

• Query Rules

• Orchestration using Content Search Web Part

Overview

Web PartResult Source

(Scope)

Result Type Item TemplateControl

Template

Search Index

Search Result Web Part

CSWP is hard set

Crawled and Managed Properties

Column Internal Name Title

Crawled Property ows_Title

Managed Property Title

Column Internal Name (taxonomy) MyLocation

Crawled Property ows_MyLocation, ows_taxId_MyLocation

Managed Property owstaxidMyLocation

Column Internal Name (date) ArticleStartDate

Crawled Property ows_ArticleStartDate, ows_q_DATE_ArticleStartDate

Managed Property (type text) ArticleStartDateOWSDATEuse Date00 / RefinableDate00

What makes a SharePoint column/field searchable?

Managed Property Crawled Property

What makes a SharePoint column/field searchable?

Crawled Property Managed PropertyIncluded in

Full text-indexNot included inFull text-index Searchable

NotSearchable

ColumnSearchable

x ✓

x ✗

x x ✓

x x ✓

x x ✗

x x ✗

KQL - Demo

contoso

contoso marketing

contoso OR marketing

((contoso OR marketing) OR (sales)) NOT bistro

author:julian

author:julian author:garth

author:julian AND author:garth

author:garth title:sales

size:50..100

write:“this week"

write:"last month"

contoso NEAR(2) marketing

contoso ONEAR(3) marketing

marketing ONEAR(3) contoso

contoso XRANK(cb=10) marketing

KQL - Demo

GP0|#<guid> All items tagged with term

GPP|#<guid> All child items of term, but not the term

GTSet|#<guid> All terms in term set

All Departments

owstaxIdDeptTaxonomy:"GTSet|#8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f"

Engineering (only have one level)

owstaxIdDeptTaxonomy:"GP0|#c7284168-2c56-460c-bb37-743a62b4ba57"

FQL – It’s all really FQL

• More operators• starts-with

• ends-width

• filter

• .. http://msdn.microsoft.com/en-us/library/office/ff394606(v=office.15).aspx

• Perhaps not for human input

• Refinement filters by default are FQL – ranking will be different

FQL Demo – It’s all really FQL

• KQL: contoso marketing

• FQL: and("contoso", "marketing")

• KQL: ((contoso OR marketing) OR (sales)) NOT bistro

• FQL: andnot(or(or("contoso", "marketing"), "sales"),"bistro")

• FQL: title:starts-with("knowledge")

• Perhaps not for human input

• Refinement filters by default are FQL – ranking will be different

Result Sources

• Think of them as 2010 scopes with sorting powers• What should be included or omitted?

• SSA, Tenant, Site Collection, Site Levels• GUIDs change on import for SearchConfig export/import

Query Variables – web part on page to filter page tag against people

• {?} notation – exclude if empty

• {\} notation – don’t add quotes

• {|} notation – multi-value expansion

• User

• Page

• QueryString

• Custom ones – inject in page or webpart• User segments -> query rules

Query Rules

• Triggering

• Rewrite

• Reorder – only one

• Groups with stop/continue

• Result Blocks

Search Orchestration

• Create seven result sources (two for triggering)

• Create two query rules – above and below the fold

• Add result blocks per rule

• Edit page, reconfigure CSWP to use above sources

• Use async for the below the fold web parts

Summary

• You are the conductor!

• You are responsible for making the connections between• Column -> cp -> mp -> result source -> query rule -> web part

• Result type -> display template -> web part

Turning Business Rules into Query Rules

It’s all about..