Issue with Filtering Search Results by Domain in PnP Modern Search Web Part #4044
Answered
by
kasperbolarsen
Fady-Mikhael
asked this question in
Q&A
Replies: 1 comment 1 reply
-
As per the Q&A section in the documentation ,
https://microsoft-search.github.io/pnp-modern-search/QnA/ we recommend
using SharePoint search where possible, and especially for People search
as Microsoft search just isn't at par yet.
As per making sure the query only returns your specific domain, please see
https://microsoft-search.github.io/pnp-modern-search/scenarios/Create-a-useful-People-Search/
…On Sun, Oct 13, 2024, 15:31 Fady-Mikhael ***@***.***> wrote:
Hello,
I am working on a project using the PnP Modern Search Web Part with
Microsoft Graph to query user information. My goal is to filter the search
results to only show users with email addresses from a specific domain
(e.g., @mycompany.com). I am using version 4.8.0 of the Web Part.
*Problem:*
Despite applying a filter in the queryTemplate configuration of the PnP
Search Web Part, the results still include users with email addresses from
other domains (e.g., gmail.com, example.com), in addition to those from
the specified domain.
The queryTemplate contains the filter resource.userPrincipalName:*@
mycompany.com, but results from other domains continue to appear.
*Steps Taken:*
I tried removing the queryString to see if that would allow the
userPrincipalName filter to be applied properly, but the issue persists.
I manually filtered the results client-side using a conditional check (if
statement) on userPrincipalName, and it works as expected. However, the
goal is to have the filtering done via the query to avoid manual filtering
post-query.
I would prefer that the filtering happens at the query level through
Microsoft Graph so that the results returned are already filtered by domain.
—
Reply to this email directly, view it on GitHub
<#4043>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE5DXITPTPVSNAOUA3RMV6DZ3JY4JAVCNFSM6AAAAABP3OHUJOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGU4DGOJWHE3TOOI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Fady-Mikhael
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am working on a project using the PnP Modern Search Web Part with Microsoft Graph to query user information. My goal is to filter the search results to only show users with email addresses from a specific domain (e.g., @mycompany.com). I am using version 4.8.0 of the Web Part.
Problem:
Despite applying a filter in the queryTemplate configuration of the PnP Search Web Part, the results still include users with email addresses from other domains (e.g., gmail.com, example.com), in addition to those from the specified domain.
The queryTemplate contains the filter resource.userPrincipalName:*@mycompany.com, but results from other domains continue to appear.
Steps Taken:
I tried removing the queryString to see if that would allow the userPrincipalName filter to be applied properly, but the issue persists.
I manually filtered the results client-side using a conditional check (if statement) on userPrincipalName, and it works as expected. However, the goal is to have the filtering done via the query to avoid manual filtering post-query.
I would prefer that the filtering happens at the query level through Microsoft Graph so that the results returned are already filtered by domain.
Environment:
PnP Search Version: 4.8.0
API: Microsoft Graph (Beta)
Question:
How can I ensure that the userPrincipalName filter is properly applied to exclude users from other domains? Could this be related to how the queryTemplate and queryString interact, or is it a bug with the Web Part? The manual filtering works, but I'd like to achieve the desired behavior directly through the query.
Thank you in advance for your assistance.
Beta Was this translation helpful? Give feedback.
All reactions