1

Goal:

Create a search solution that only searches one specific document library.

Steps:

Using the latest version of this SPFx solution found here: https://github.com/microsoft-search/pnp-modern-search

Insert a search box and connect it to a results web part.

Create a results source that targets items in the library only:

{searchboxquery} 
Path:"https://tenant.sharepoint.com/sites/sitename/Shared%20Documents" 
(IsDocument:"True" OR contentclass:"STS_ListItem")

The query builder test results are correct. Enter the results source GUID in the results web part properties.

Problem:

The results are inconsistent and return more items than are in the library, including some correct results but also oddly many from geolocation sites that are 100% irrelevant to the search parameters. For example: tenantgbr.sharepoint.com....., tenanteu.sharepoint.com.............

By the way, in the classic site this library was migrated from, content search web parts configured the same way worked perfectly, so pretty sure the config isn't the issue.

0

I had removed the path: to the library from the query template option while troubleshooting this issue, but when I added it back, it started working correctly again. The only other thing I did was remove a space from the library name/url which I'd read may cause issues when the server crunches the incoming query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.