microsoft-search / pnp-modern-search

Home of PnP Modern Search solutions, helping you move from classic to modern SharePoint and beyond
https://microsoft-search.github.io/pnp-modern-search
Other
386 stars 340 forks source link

PNP is manipulating query template for few users #3127

Closed shaileshmax closed 1 year ago

shaileshmax commented 1 year ago

PNP webpart is manipulating query template for few users.

We raised the issue initially with Microsoft for documents displaying same in different pages, which are using search query webpart. They investigated and summarised to following:

You are using PNP search results modern webpart in site pages which pulls result from Documents library of respective site. You just access\load the page & aren’t performing any search. "UserA" see results from all over tenant (non working) and "userB" see results only from that respective site (working). Permissions are identical.

Upon further checking i found that below query template is the differentiator, you have it in PNP search webpart. We created new page added the webpart, user A and B were seeing all results, we pasted this query template and that made the difference. A continued to see results from all over but B saw results from Doc library of that site.

(({searchTerms} OR RefinableString01:{searchTerms} OR RefinableString07:{searchTerms}) OR ("{searchTerms}" OR RefinableString01:"{searchTerms}" OR RefinableString07:"{searchTerms}")) AND ((IsDocument:true AND (FileType<>one AND FileType<>html AND FileType<>aspx) OR (FileType:chm AND IsDocument:false))) -contentclass:STSList* -IsContainer:true Path:{Site.URL}

In our last call, we isolated it further, the issue persists even after replacing Site.URL with actual subsite URL. Noticed that User A doesn't have issue while using search API directly\any OOB method i.e. they see desired results (15).

So its specific to PNP search webpart and specific to few users. As you can see above OOB search query gave 15 results whereas same query in PNP retuned 16K results.

Also I noticed that you seem to be running older version of PNP webpart, i installed it in my tenant and im on higher version.

As this issue cannot be reproduced without PNP webpart\it only happens while using the webpart, you will have to reach out to PNP support to understand why\how PNP is manipulating query template for few users and how it can be addressed.

kasperbolarsen commented 1 year ago

First of all, there is no PnP support organization. This is an open source project and there are no SLAs and the like. Please fellow the guidelines in the issue template, otherwise we will not be able help you.