0

I have a single, SharePoint Online site collection with many site pages. Most of the content on the site pages is filtered lists displayed using a content query web part. Search queries are set to go to a custom results page, and on that page I have a search results web part.

I'd like to restrict search results to only return site pages and/or files from a couple specific libraries. I've tried using the property filter, but haven't been able to get the correct search results. I'm thinking something like this:

{SearchBoxQuery} -IsContainer:true -Filename:AllItems -Filename:AllPages -Filename: Thumbnails path:"https://site.sharepoint.com/sites/sitename" 

Suggestions?

Is this even possible? (And if it is) Is this the best way to do it?

0

Create a Result Source with following QueryText:(Replace the IDs with the correct list ids)

{searchTerms} (ListID:{DDD70E78-941F-45EC-85E0-649B1F6DFE02} OR ListID:{DDD70E78-941F-45EC-85E0-649B1F6DFE02} )

Edit the Search results webpart and Click on Change Query. Select the Result Source you created.

0

You can also restrict the results based on the Content Type of your pages. I do this quite often on Publishing Sites. ContentType:NewsPage for example.

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.