2

Is it possible (and when yes, how?) to configure a Content by Search WebPart (SP2013) to search only items in current web and subwebs?

For example I have a CBSWP on a page with path: http://site/web1/default.aspx There are some subsites:

- http://site/web1/default.aspx
- http://site/web1/web2
- http://site/web1/web2/webXy
- http://site/web1/web3

I want it to find items with CSB in web1 that are located in "web1", "web2", "webXy", "web3" but not in "site" (webs or site that are higher in the web hierarchy).

Experimented a bit with the "path:" setting but it seems not to understand wildcards and it gives no results when I don't use the site collection url (e.g. when I give it the url of a sub web).

Anyone got an idea how to solve this?

  • This is can be done depending on what you need to find. Do you need to search all content within the subsites? ie, documents, pages, items from custom lists etcetera? – Alvmad Jul 29 '13 at 16:18
  • Basically I want to aggregate (list) all items of a specific type (eg tasks/issues/decisions..) for a given web and its subwebs but not the webs above it. – Shihan Jul 30 '13 at 13:39
  • Works for me if I put Path:sites/web1*. Can you show us the query text you are using? – MLF Sep 5 '14 at 20:10
  • That should actually include http(colon)(slash)(slash) before the sites. It got removed. – MLF Sep 5 '14 at 20:11
1

Can you test this in the query text?

path:"http://site/" contentclass:STS_ListItem Site <> {Site.URL}

Tell me if that worked out. Maybe I can test with other query

1

Ideally when we write site path in Content Search Web Part Query, it brings through result from that site and its sub site OOB. we don't need to do anything extra on top of it.

1. If your requirement is to bring results from Web1 and from its sub sites, then I believe below simple query should work.

path:"http://site/web1"  

enter image description here

2. If you would want to bring through only items, then below query can be helpful.

path:"http://site/web1"   (contentclass:STS_ListItem OR IsDocument:True)

enter image description here

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.