1

I have a SXA search scope which is working, but as soon as I try to extend it with our "Company" field, it fails to find any results. Company is a multilist field.

Our steps:

  1. Create a search scope as: template:{237FD461-A7F6-4080-AFAB-57227F87782E};...;+location:{FF3E546F-C781-4B47-84D7-23CE125CF473} This works fine and is giving us the correct query and results.
  2. We have to add an extra part to the query, for our company field. I added "Company|....". This does not seem to work.
  3. I have tried to use the exact index field instead of the field name: template:{237FD461-A7F6-4080-AFAB-57227F87782E};...;+location:{FF3E546F-C781-4B47-84D7-23CE125CF473};+custom:company_sm|01f831ffc56e4cf5ba719a1e77406ec9 Still no luck.

When I try with a another multilist field on those templates, it does work. When I checked my logs for the queries Sitecore is doing I saw something strange..

The query performed was: &search=(language_1:(en) AND (template_1:(237fd461a7f64080afab57227f87782e) OR template_1:(9d791aff92314b41b482f46737a59e0c) OR template_1:(bcbc94ab9b6a40079370b5052c44b20b)) AND company_s:(01f831ffc56e4cf5ba719a1e77406ec9))&$filter=(latestversion_1 and (path_1/any(t:t eq 'ff3e546fc7814b4784d723ce125cf473')) and searchable and (path_1/any(t:t eq 'ff3e546fc7814b4784d723ce125cf473')))&queryType=full&$skip=0&$top=12&$orderby=title&$count=true

Note that Sitecore is using company_s instead of company_sm - where for a multilist field the _sm should be used.

Why is this and how can I get Sitecore to use the exact field?

1 Answer 1

1

It turns out we had another template in the same instance that also had a field called "Company", but in this case it was a droplist (and not a multilist). This caused our issues.

In the case were I tried using the Sitecore field in the query, this might make sense.. Sitecore has no clue which index field to take.

In the case were I used the actual index field however, I did expect Sitecore to leave that field alone and use it, but apparently they don't (with Azure Search). After talking to Support, this is registed as a bug in 9.0.2 (ref 301873).

I fixed it by removing (or renaming) one of the Company fields to make sure there was no "duplicate" in the index. One this was done, I had to rebuild all the affected indexes (note that in Azure you can easily remove the indexes first to make sure they really start from scratch).

Lesson learned: never have multiple fields from a different type with the same name in the same instance...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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