I'm using content search webparts with cross-site publishing in an on-prem SP2013 site. I've got a result source that is limited to a specific library using Query text:

{searchTerms?} (contentclass:sts_listitem OR IsDocument:True) SPSiteUrl:https://sites.sp.kp.org/teams/lscsp-cat10 ListId:0cd3f39e-61e4-456e-a149-85cb79292589

That retrieves all items from the list -- which includes individual documents, folders, and document sets. I want to only retrieve items at the first level of the library. Only documents and folders at the top level, not documents inside folders or document sets.

I've been looking through these tutorials on KQL and find lots of ways to limit to the parent of a term set.

I did find the managed property ParentLink and am using something like this:

ParentLink:'https://<site>/<library name>/Forms/AllItems.aspx'

Which does work because the parent link for anything in a folder will be different. But that seems pretty much like a bad hack.

Is there an official way using KQL to tell a CSWP "Only contents of this folder, don't look in nested folders."?

1 Answer 1


Try this: ParentLink: {/yourlibname/}

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.