API Questions on Kentico API.
Version 5.x > API > Kentico path to select a document and all its children? View modes: 
User avatar
Guest
Henry Chong - 8/18/2011 9:26:09 PM
   
Kentico path to select a document and all its children?
Hi guys,

I'm currently making some customizations to the default SmartSearch webparts in Kentico to allow search "scopes" by setting the Path property on the SearchResults web part. I was wondering if anyone whether its possible to write a path that would select a document and all its children, so for example if my site was:


(Root)
- Section 1
- Page 1
- Page 2
- Section 2
- Page 1
- Page 2
- Page 3


if i do a path like "Section 1/%", i will get Page 1 and Page 2 returned. However, I want to also include Section 1 in my path (but not Section 2). Is it possible to do this with one path expression which will be consistent no matter what page i am on, on the site?

Warm regards,

Henry

User avatar
Member
Member
kentico_michal - 8/19/2011 5:24:39 AM
   
RE:Kentico path to select a document and all its children?
Hello,

Regrettably, this can not be specified in the Path property of the web part since only one path expression can be defined.

However, it can be achieved by specifying multiple definitions of allowed content in index settings [Site manager -> Administration -> Smart Search -> edit index -> Index]:

DOCUMENT TYPES: PATH: INDEX TYPE:
<document types> /Section1 Allowed
<document types> /Section1/% Allowed


In other word you need to specify two definitions, one for the parent and one for child documents.

Best redards,
Michal Legen