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
390 stars 341 forks source link

People search with multiple filters does not work #3970

Closed Cpoinsignon closed 2 months ago

Cpoinsignon commented 2 months ago

Version used Ex: 4.8

Describe the bug I wanted to exclude users having "adm" (technical account for admins) and "EXT" (guests users) in the people search result. I have tried this filter: not(UserName:"adm" OR UserName:"EXT") but it gives no result the filter not(UserName:"adm.") gives results the filter not(UserName:"EXT") gives results but combination of both does not work

I have also tried without the NOT UserName:"adm" gives 13 results UserName:"EXT" gives 15 results UserName:"adm" OR UserName:"EXT" gives no result (expected 28)

To Reproduce Detailed steps to reproduce the behavior: Combine two filters on the same property with OR

Expected behavior Exclude ADM and EXT from people search results

Screenshots image

Desktop (please complete the following information):

Additional context N/A

Cpoinsignon commented 2 months ago

If I put the filter in the query template, it works !

image

kasperbolarsen commented 2 months ago

So the issue has been solved? If you are looking into additional filters for UPA profiles I have a guide: https://www.m365thinking.com/post/sharepoint-people-search-how-to-clean-up-your-results-by-excluding-accounts

Cpoinsignon commented 2 months ago

Yes, I have a workaround which works. But why the same filter in the "advanced search filter" does not work?

kasperbolarsen commented 2 months ago

Oh, that is not a workaround. The search query template is absolutely not the same as the search query text, as per the documentation at https://microsoft-search.github.io/pnp-modern-search/usage/search-results/data-sources/

If you look at API calls in the dev tools it becomes really clear