I have a library with 7 folders. I want to include the results of my search from 4 folders only not all of the library. I need the query syntax what we need to use in search result web part as i don't see any documentation to work with folders for search query.

2 Answers 2


Update the Ahmad Zia’s reply:

You need to enter the query path:http://<server>/<site>/<libray>/<folder> without “Forms”.

For example:



(“Doc1” is the library name, “f1” and “2018” are folder names)

enter image description here

  • Yes, this seems to be perfect solution. I have another question, do we have any ability to use folder ID instead of name as 1 user he changed the name of the folder and the results were gone. Dec 4, 2017 at 13:16

The query syntax for multiple paths is

(path:"http://site/library/Forms/Forms1/*" OR path:"http://site/library/Forms/Forms2/*")

This should search only in two folders Forms1 and Forms2 of library. You can extend this for 7 folders

  • I don't think that's the syntax. The above answer was what worked for me. Thanks for your response Dec 4, 2017 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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