Dec 10 2023 05:35 PM
Hi everyone,
I've created a search engine using PnP Modern Search v4, utilizing a SharePoint List that I personally set up with the following query template:
{searchTerms} Path:https://{my-o365}.sharepoint.com/sites/{my-site/my-subsite}/Lists/{list-name} contentclass:sts_listitem
Currently, I'm facing an issue where I need to type the full word ("Surabaya") in the City column to get the desired search results. However, I want to configure the search terms so that typing a keyword like "Sura" will display the row with the value "Surabaya" in the City column.
---
Can anyone guide me on how to achieve this configuration? I appreciate any assistance in optimizing the search functionality to provide more intuitive results based on partial keywords.
Thank you!
Dec 14 2023 10:36 PM
SolutionHello @arine1901
you can use * as a wildcard after the term do you search. As example:
No results
And now with *:
You can find more about search syntax:
Please attention: KQL queries don't support prefix matching with the wildcard * as prefix.
Best, Dave
Dec 18 2023 02:05 AM
Dec 20 2023 06:30 AM
@arine1901 To enhance partial keyword search in your PnP Modern Search v4 setup, modify the query template by incorporating fuzzy search operators. These operators enable searching for words similar to the specified term, even if they're not an exact match.
{queryTerms:contains(["*Sura*", *Surabaya*]) Path:https://{my-o365}.sharepoint.com/sites/{my-site/my-subsite}/Lists/{list-name} contentclass:sts_listitem}
{queryTerms:contains(["*Sura*", *Surabaya*]) Specifies the search terms using the contains operator. In this case, it looks for words containing the substring "Sura" or the exact term "Surabaya."
Path:https://{my-o365}.sharepoint.com/sites/{my-site/my-subsite}/Lists/{list-name} contentclass:sts_listitem Specifies the source of search results, targeting the SharePoint List named "list-name" in the "my-subsite" subsite of "my-site" on the "my-o365" O365 tenant.
Dec 14 2023 10:36 PM
SolutionHello @arine1901
you can use * as a wildcard after the term do you search. As example:
No results
And now with *:
You can find more about search syntax:
Please attention: KQL queries don't support prefix matching with the wildcard * as prefix.
Best, Dave