Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter Bradsted Bodenhoff 27 posts 47 karma points
    May 23, 2011 @ 15:31
    Peter Bradsted Bodenhoff
    0

    Exclude subpages

    Hi

    Is it possible to exclude a certain part of the content-tree from the search?

    Let's say I have the following structure and I want XSLTSearch to exclude Sub2 (and children) from the search...

    Lev1
    - Sub1
    -- Sub11
    Lev2
    - Sub2
    -- Sub21
    -- Sub22
    Lev3
    - Sub3
    -- Sub31

  • Rich Green 2246 posts 4008 karma points
    May 23, 2011 @ 15:37
    Rich Green
    0

    Hey Peter,

    You can modify the XSLT to exclude certain Doc Types, which will achieve you need, or you could modify the XSLT to *only* search the Lev1 doctype.

    Of course you can filter only certain fields within the Macro, so unless Lev1 / Sub1 have the same property alias (bodyText etc.) they will never be searched. 

    Rich

  • Kim Andersen 1447 posts 2197 karma points MVP
    May 23, 2011 @ 15:41
    Kim Andersen
    0

    Hi Peter

    You should be able to exclude nodes that has a certain level. Or nodes under a certain level. Which version are you using?

    Could you show us the "content" of the possibleNodes-variable?

    /Kim A

  • Peter Bradsted Bodenhoff 27 posts 47 karma points
    May 23, 2011 @ 16:02
    Peter Bradsted Bodenhoff
    0

    I'm using XSLTsearch version 3.0.1

    hmm, what do you mean by 'the "content" of the possibleNodes-variable'?

  • Kim Andersen 1447 posts 2197 karma points MVP
    May 23, 2011 @ 16:14
    Kim Andersen
    0

    I was thinking of this line:

    <xsl:variable name="possibleNodes" select="$items/descendant-or-self::*[
    @isDoc
    and string(umbracoNaviHide) != '1'
    and count(attribute::id)=1
    and (umbraco.library:IsProtected(@id, @path) = false()
    or umbraco.library:HasAccess(@id, @path) = true())
    ]"/>

    But do you want to exclude all pages at the levels under level 3? This would be all pages under Sub 1, Sub2 and Sub3? Or only nodes under Sub2?

    If you only want to exclude nodes under Sub2, I think you should create a true/false property (called excludeFromSearch in the below code) that can be checked if a node should be excluded from the search. Then you can change the above code to this:

    <xsl:variable name="possibleNodes" select="$items/descendant-or-self::*[
    @isDoc
    and string(umbracoNaviHide) != '1'
    and string(excludeFromSearch) != '1'
    and count(attribute::id)=1
    and (umbraco.library:IsProtected(@id, @path) = false()
    or umbraco.library:HasAccess(@id, @path) = true())
    ]"/>

    /Kim A

     

Please Sign in or register to post replies

Write your reply to:

Draft