Microsoft Search KQL question

%3CLINGO-SUB%20id%3D%22lingo-sub-3338551%22%20slang%3D%22en-US%22%3EMicrosoft%20Search%20KQL%20question%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3338551%22%20slang%3D%22en-US%22%3E%3CP%3EI%20want%20to%20create%20a%20custom%20search%20vertical%20in%20Microsoft%20Search%20that%20returns%20People%20results%20only.%20I%20have%20created%20a%20new%20Search%20Vertical%20and%20added%20the%20following%20KQL%20in%20the%20Query%20option%20but%20it%20doesn't%20return%20any%20results.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%3E(%7BsearchTerms%7D)(ContentClass%3Durn%3Acontent-class%3ASPSPeople)%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EHave%20I%20got%20the%20syntax%20right%20or%20am%20I%20missing%20something%20else%3F%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAny%20pointers%20to%20help%20solve%20this%20would%20be%20much%20appreciated.%3C%2FP%3E%0A%3CP%3EThank%20you%2C%3C%2FP%3E%0A%3CP%3ESteve%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3338551%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESearch%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3350459%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Search%20KQL%20question%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3350459%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F43161%22%20target%3D%22_blank%22%3E%40Steve%20Knutson%3C%2FA%3E%2C%20your%20query%20should%20work%2C%20but%20you%20can%20try%20modifying%20it%20to%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%3F%7BsearchTerms%7D%20ContentClass%3Durn%3Acontent-class%3ASPSPeople%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHave%20you%20checked%20that%20your%20result%20source%20includes%20Local%20People%20Results%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2F27sb3h-admin.sharepoint.com%2F_layouts%2F15%2Fsearchadmin%2FManageResultSources.aspx%3Flevel%3Dtenant%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2F27sb3h-admin.sharepoint.com%2F_layouts%2F15%2Fsearchadmin%2FManageResultSources.aspx%3Flevel%3Dtenant%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3354486%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20Search%20KQL%20question%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3354486%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1239196%22%20target%3D%22_blank%22%3E%40Maggan_W%3C%2FA%3E%26nbsp%3Bthank%20you%2C%20I%20think%20that%20helps%20answer%20my%20question.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMicrosoft%20Search%20doesn't%20allow%20you%20to%20select%20a%20specific%20result%20source%20when%20creating%20a%20custom%20search%20vertical.%20The%20%22SharePoint%22%20option%20doesn't%20include%20people%20results%2C%20which%20is%20why%20I%20get%20nothing%20back%20when%20I%20use%20the%20KQL%20query.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI've%20gone%20with%20plan-b%20and%20used%20PnP%20Search%20with%20some%20filtering%20to%20exclude%20guest%20users.%20That%20does%20the%20trick%20for%20now.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
MVP

I want to create a custom search vertical in Microsoft Search that returns People results only. I have created a new Search Vertical and added the following KQL in the Query option but it doesn't return any results. 

 

({searchTerms})(ContentClass=urn:content-class:SPSPeople)

 

Have I got the syntax right or am I missing something else?

 

Any pointers to help solve this would be much appreciated.

Thank you,

Steve

 

 

 

2 Replies

@Steve Knutson, your query should work, but you can try modifying it to this:

 

{?{searchTerms} ContentClass=urn:content-class:SPSPeople}

 

Have you checked that your result source includes Local People Results?

 

https://27sb3h-admin.sharepoint.com/_layouts/15/searchadmin/ManageResultSources.aspx?level=tenant

 

 

 

@Maggan_W thank you, I think that helps answer my question.

 

Microsoft Search doesn't allow you to select a specific result source when creating a custom search vertical. The "SharePoint" option doesn't include people results, which is why I get nothing back when I use the KQL query.

 

I've gone with plan-b and used PnP Search with some filtering to exclude guest users. That does the trick for now.