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


01 October, 2024

Sitecore Commerce - Refresh Commerce Cache - This operation is not available unless admin mode is enabled: FLUSHDB

In one of the eCommerce application, Sitecore Commerce 10.1.1 is being used. After few infrastructure consolidation, testing out Refresh Commerce Cache option in CM resulted in the below error. 

Based on the exception, we found that we can add AllowAdmin option to the Sitecore Commerce Redis Connection string. All Commerce related settings are available in this folder - \App_Config\Include\Y.Commerce.Engine.

In Sitecore.Commerce.Engine.Connect.config, allowAdmin=true configuration is added to the Redis Connection string. Refreshing the commerce cache worked without an error. 



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