How Do I Search A Sharepoint List By Using Prefix And Suffix Wildcards And Pagination?

Hermoso, Khen Wilson 1 Reputation point
2022-10-12T00:44:31.737+00:00

I am trying to develop a html/css/js frontend that allows me to search my SharePoint online list as I would a normal list. This turned out surprisingly impossible for MS Sharepoint.

By trial and error and reading through the sparse documentation, I did the following:

  1. I tried using Search Rest API, but it doesn't allow suffix matching, so *arepoint won't return items that have words like sharepoint.
  2. I tried using CAML query, but it doesn't allow me to jump to a page because I can't define a start row.
  3. I tried using list filtering, but its "substringof" filter doesn't allow me to search multiline text.

Basically all three of them seem to have at least one glaring issue that impedes normal usage.

I'd like to know if anybody found a way to get around the issues of any one of the three methods.

I didn't paste the code because the issue I'm having is with the API's themselves, but I could post them if needed. MS Sharepoint just flat out said it doesn't support suffix matching with no further explanation like a punch in the face.

Edit: The workaround that I have so far is to get all the items as one giant JSON and do the searching and filtering client side, but that's already slow with my 900 row list.

Thanks

Microsoft 365 and Office SharePoint For business Windows
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2022-10-12T06:14:25.087+00:00

    Hi @Hermoso, Khen Wilson
    As far as I know, SharePoint only support for prefix matching. You can specify part of a word, from the beginning of the word, followed by the wildcard operator, in your query, as follows. This query would match results that include terms beginning with "hila", followed by zero or more characters, such as hilarious, hila, hilaa, hilab and so on.

    hila*  
    

    I have found a similar issue with yours for reference
    https://stackoverflow.com/questions/69226066/sharepoint-online-search-file-name-by-middle-characters#:~:text=SharePoint%20does%20not%20support%20suffix%20wildcard%20search%2C%20it,with%20the%20terms%20stored%20in%20the%20full-text%20index.

    And here is the document for more details
    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.