0

I'm trying to setup a search query to look @ one specific folder name across site collections.

If I have the 3 site collections and similar "leader" folders of:

  • SharePointMe.com/apples/GrannySmith/leader
  • SharePointMe.com/grapes/concord/seedless/leader
  • SharePointMe.com/tomatoes/green/frozen/leader

How can I get a query to look for anything in these 3 "leader" folders?

I'm trying this query text in query result sources, but it's not working:

SitePath:"SharePointMe*/leader"

So far, I'm testing this for my query:

SitePath:"http://www.SharePointMe*" Title:leader

...but this is relying on the title of the document to have "leader" in it, not really pulling everything back under the "leader" folder...which is what we need.

I have read too that prefix matching doesn't work, but was hoping the above scenario would...but no luck so far.

1

Instead of looking directly for the folders, you'd probably want to query the 'Path' variable for all items where it contains 'leader'?

Path:{Site.URL}/leader

Plus, if you configure this at the root site collection, this should get all other site collections below as well. {Site.URL} could also be exchanged for {SiteCollection.URL}

0

I don't know witch SharePoint are you using 2010 or 2013 here is a good answer how you can query folders with CAML query.

<FieldRef Name="FileDirRef"></FieldRef>
<Value Type="Text">Server Relative URL of the Folder</Value>

You can get the folder using SPQuery.Folder and search for SPListItems from code behind.

  • 2013 version we are using – Sol Web Solutions Jul 17 '14 at 19:53
  • We are looking for something end users could update on an SCA (Site Collection Administrator) level, and not need to write code. – Sol Web Solutions Jul 17 '14 at 19:58
  • We have our search result working, though it's not very dynamic: SitePath:"sitename/sites/mainParent/ChildRecordCenter/Leader*" SitePath:"sitename/sites/mainParent/general/Leader*" This doesn't lend too well if we start to have 100+ sub-sites under "mainParent"...which is very possible. Almost like TSQL where you can use the "%" character would be perfect to grab that "leader" folder. – Sol Web Solutions Jul 17 '14 at 19:59

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.