wild card search issue in spfx

Sajith Gopalakrishnan Hema 1,036 Reputation points
2022-02-16T08:21:09.867+00:00

I am trying to search the user first name using spfx.

qrytext = FirstName:${searchString}*

The * symbol consider both the words in First Name if there is a space. For example, SharePoint Online. How to achieve only to get starting from S ?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,626 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 34,821 Reputation points Microsoft Vendor
    2022-02-17T06:29:35.727+00:00

    Hi @Sajith Gopalakrishnan Hema ,
    You can try to use refinement filters or wild cards in SharePoint search API
    Maybe one of the endpoint given below:

    _api/search/query?refinementfilters='FirstName:("s*")'  
    

    or

    http://server/_api/search/query?query_parameter=value*  
    

    The document you can refer to
    https://learn.microsoft.com/en-us/previous-versions/dynamicsnav-2013r2/hh169248(v=nav.71)?redirectedfrom=MSDN
    https://learn.microsoft.com/en-us/sharepoint/dev/general-development/keyword-query-language-kql-syntax-reference


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.