2

So I've got certain items indexed. Each item has a tags field, which is used in search.

Tags field example:

"tags": 
"{62AEFBF6-2580-4C80-A4E2-D9E82055DCE0}
|{5A3775E0-8D9F-42FA-B34D-5E93EAA56D4C}
|{20669674-ED92-488F-BFC7-4C45F4BF3C19}
|{C926F3FB-CAF6-4606-BBC3-12033A9CD866}
|{10BC8E78-FF2B-460B-AB71-97FF5E74656A}"

So it's just a set of IDs.


Then I'm using a query to get these items by their tags.

Here's a query:

sitecore_full_path:(/.*path*/)  
AND (tags: (5c076a7b\-70a0\-4d1c\-9acd\-8d69db8d21e4)  
AND tags: (10bc8e78\-ff2b\-460b\-ab71\-97ff5e74656a) 
AND tags: (7a111a76\-1c4f\-4918\-8f16\-54fdf856ea6b))...

The problem is that when I use this query, Azure Search returns a couple of extra items, which don't have some of the tag IDs in their tags field. Although, I'm using AND operator in my queries, so that shouldn't happen.


For example: I would like to get items that have tag A, tag B and tag C. So I use this query:

sitecore_full_path:(/.*path*/)  
AND (tags: (A) AND tags: (B) AND tags: (C))...

And as a result I get 6 items. Three of them have all of these tags in the tags field, but other three - only have B and C.

So I'm wondering, is this an Azure Search issue or there is something wrong with my query or indexes?

  • Are you calling Azure Search directly or going through the ContentSearch API? – Richard Seal Jun 27 '18 at 13:38
  • Can you add the code snippet, it will help to understand the issue Properly. As richard asked. are you using sitecore Content search api ? – Balaji Balasubramanian Jun 27 '18 at 16:48
  • Hello @RichardSeal, sadly, it behaves the same in both cases. – Ross Kostenko Jun 29 '18 at 8:26
1

I ran into several issues with Azure search as well and in most cases, it had something to do with one or more of the major differences between using Lucene or Solr and azure search and how Azure search handles queries differently sometimes.

concerning your query, I think you are running into a 'by design' feature of azure search. searching for multiple string terms is interpreted differently on Azure search that it would on Solr / Lucene. please take a look at this and determine if this can be the cause of you issue. https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/search_and_indexing/sitecore_azure_search_overview#_Limitations_of_Azure

Automatic tokenization - The Azure Search service automatically tokenizes document field values and queries when searching and faceting. This means that: Substring searches that are limited to a single term, for instance, predicates, .StartsWith(), .EndsWith() and .Contains(), will match parts of terms, and will match terms that are located in any part of the field value. When multiple terms are passed, each term is searched separately, (this can provide more results than expected).

cheers, Pierre

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.