Search partially working with spSearchQueryPattern

Hi,
My search seems to be only partially working when I specify the spSearchQueryPattern

    renderer.config.spSearchQueryPattern =  "PreferredName: {{keyword}}* OR FirstName: {{keyword}}* OR LastName: {{keyword}}* OR Title: *{{keyword}}* OR SPS-Responsibility: *{{keyword}}* OR SPS-Skills: *{{keyword}}*";
renderer.config.searchResultMaxCnt = 20;

It searches on PreferredName, FirstName and LastName but doesn't work for Title, SPS-Responsibility or SPS-Skills.

I've also tried formatting it as:

renderer.config.spSearchQueryPattern = 'PreferredName: "{{keyword}}*" OR FirstName: "{{keyword}}*" OR LastName: "{{keyword}}*" OR Title: "*{{keyword}}*" OR SPS-Responsibility: "*{{keyword}}*" OR SPS-Skills: "*{{keyword}}*"';

It hasn't worked either. If I remove the pattern, the search works as expected.

Hi @atomicharri,
You should use the managed properties names in the search query. Please open the Search Chema in your SharePoint Admin center to look up the search properties:


Please try

renderer.config.spSearchQueryPattern = '"JobTitle": {{keyword}} OR "Skills": {{keyword}}*'

Also, please note that "{{keyword}} is not supported by SharePoint (https://docs.microsoft.com/en-us/sharepoint/dev/general-development/keyword-query-language-kql-syntax-reference), only prefix matching with {{keyword}}* or exact matching with {{keyword}}

ah thank you! that was it :slight_smile: