Copied to clipboard

Flag this post as spam?

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


  • suzyb 474 posts 932 karma points
    May 16, 2012 @ 15:11
    suzyb
    0

    Search two roots

    I have a site with some landing pages organised in a folder at the same level as the root i.e.

    home
    -- page
    -- page
    landing pages
    -- landing page
    -- landing page

    When searching the site I would like to search these landing pages as well as the home and pages under it.

    I think I'd need to modify the param when it calls the search template but I'm not exactly sure how.  Can anyone help.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    May 16, 2012 @ 15:24
    Douglas Robar
    0

    From your sample content tree it appears you want to search all the content in your site no matter where it exists. If that's the case, you can edit the XSLTsearch template (or whatever template your search page uses to display the search results) and specify the source node in the XSLTsearch macro to be "-1", which means search everything.

    cheers,
    doug. 

  • suzyb 474 posts 932 karma points
    May 16, 2012 @ 15:31
    suzyb
    0

    hmm the source is set to -1 but it isn't showing the landing pages in the results.

  • suzyb 474 posts 932 karma points
    May 16, 2012 @ 23:41
    suzyb
    0

    I believe I have fixed the problem, thus far it seems to work.  I changed the code for the number($source)= -1 or number($source)= 0 when to this.

    <xsl:when test="number($source)= -1 or number($source)= 0">
    <!-- using ALL nodes -->
    <xsl:call-template name="search">
    <!-- searches absolutely all pages (useful if you want to search multiple sites at once, or if you do not have all your content pages below a common homepage node in the content tree)-->
    <xsl:with-param name="items" select="umbraco.library:GetXmlAll()/* [@isDoc and @level = 1]"/>
    </xsl:call-template>
    </xsl:when>

    I think this may be a bug.  As I understand it $currentPage/ancestor-or-self::* [@level = '1'] which it originally was will climb the tree from the current page and get it's level 1 ancestor but it wont get that page's siblings.

  • Thom Hubers 26 posts 47 karma points
    Jul 31, 2012 @ 16:17
    Thom Hubers
    0

    Somehow the High five! function is broken. So here it is: Suzyb, High five! This was the solution.

Please Sign in or register to post replies

Write your reply to:

Draft