pnp/sp-dev-solutions

react-search-refiners: issue with multi-value managed metadata token replacement

RichG82 opened this issue · 1 comments

Category

  • Question
  • Bug
  • Enhancement

Expected or Desired Behavior

The token replacement should act like the SharePoint search token replacement by OR-ing the query such as translating this:

ContentTypeId:0x0101009D1CB255DA76424F860D91F20E6C411800E6AC0A08EAEEBF4FB7A1CD01XXXXXXXX* AND {|owstaxidmetadataalltagsinfo:{User.SubscriptionsMMDUserProfileField}}

into what OOB SharePoint search turns into this:

ContentTypeId:0x0101009D1CB255DA76424F860D91F20E6C411800E6AC0A08EAEEBF4FB7A1CD01XXXXXXXX* AND ((owstaxidmetadataalltagsinfo:#008466174-8d23-47de-af95-71f99bd88396) OR (owstaxidmetadataalltagsinfo:#0ec0eccb9-dcf1-45e2-9f75-1cd70494401c) OR (owstaxidmetadataalltagsinfo:#05f287ce5-796c-408c-afd1-a569cd19ba42))

Observed Behavior

Token replacement adds commas in between the separate terms so the resulting query does not return the expected results (and is possibly an incorrect query)

Source query:
{searchTerms} ContentTypeId:0x0101009D1CB255DA76424F860D91F20E6C411800E6AC0A08EAEEBF4FB7A1CD01XXXXXXXX* AND owstaxIdTopic:{Page.Topic.TermID}

Translates to:
{searchTerms} ContentTypeId:0x0101009D1CB255DA76424F860D91F20E6C411800E6AC0A08EAEEBF4FB7A1CD01XXXXXXXX* AND owstaxIdTopic:c52662de-76a9-4b63-af33-5c96801a6bf7--->,<---e5937827-fbf1-4a71-b41a-310195f46314--->,<---55f30609-524e-4934-bf77-d0d57cb1c98b

Please note: --->,<--- was just added for visibility of the comma

Steps to Reproduce

  1. Add a field called Topic (or anything) that is a multi-value managed metadata field
  2. Create 3 pages
    2a) Page A has Topic value of: Topic 1, Topic 2, Topic 3
    2b) Page B has Topic value of: Topic 1, Topic 2
    2c) Page C has topic value of: Topic 1
  3. Add a search results component with the following query in the Query Template:
    {searchTerms} AND owstaxIdTopic:{Page.Topic.TermID}

the query could also use label, it still results in unintended results (or no results):

{searchTerms} AND RefinableString00:{Page.Topic.Label}

  1. If you look at the response of the /postquery in QueryModification field, the result is a comma separated list of the terms rather than a grouped list of OR statements for the list of terms

  2. I would expect that on pages A, B and C all 3 results would be returned for each page because they all are tagged with Topic 1. This would be the case if they were OR'd together in parens.

wobba commented

Could you please log this over at https://github.com/microsoft-search/pnp-modern-search, and it's because we haven't implemented multi-term expansion. So not a bug, but a feature request :) Basically you want the {|{Something.Prop.Id}} notation support.