Pages

10 October, 2024

Coveo for Sitecore - Using Advanced Field Queries

In Coveo for Sitecore, there are scenarios where we need to create advanced complex queries to get specific results. Though we can achieve most of the search queries using basic queries, advanced queries helps us to narrow the search results. 


When dealing with Coveo Advanced field queries, 
  • queries are performed against field values directly and not through the index. 
  • can search for special characters in field values. In basic query (which is through index), special characters are not searchable. 
  • can be only searched 'with special characters' against fields that have Facet options or Free text search options enabled. 
  • drawback with advanced query is that response increases if the number of fields increases, field values and complexity of the query expression. 

Advanced Field Query Syntax



Advanced Query Field Operators


Wildcard Match (*=)

  • Handles any wildcard characters (?, *).
  • Can use one or more wildcard characters. 
Example: Intel processor containing I9

@processor *= "*I9"

Fuzzy Match (~=)

  • Expands search results by permitting slight difference between search query and results. 
  • Matches 20% difference from the search query.
Example: "Gigestive Capsules" results in "Digestive Capsules"

@medicine ~= "Gigestive Capsules"

Phonetic Match (%=)

  • Transforms query into Phonetic codes, then results that shares similar phonetic code. 
Example: Flour results in Flour and Flower

@type %= "Flour"

Regular Expression Match

  • Matches with the regular expression to get accurate results.
Example: Field containing URL with a subdomain URL. - https://prod1-cm.examples.com/product

@clickableuri /= "^https:\/\/[a-zA-Z0-9.-]*\.examples\.com\/.*$"

Scenarios


No comments:

Post a Comment

blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }