Copied to clipboard

Flag this post as spam?

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


  • Bjørn Fridal 274 posts 784 karma points
    Aug 29, 2011 @ 16:02
    Bjørn Fridal
    0

    Xslt Search: Only return results with a template or ancestor.

    Hi,

    I am trying to make "Xslt Search" search through some nodes that is not accessible since they don't have a template of their own. If these "template less" nodes are matched an ancestor (with a template) node should be returned instead.

    I need to do this operation before the variable "matchedNodes" is created.

    Has anyone tried this or has an idea of how to do it?

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Aug 29, 2011 @ 21:11
    Rasmus Berntsen
    0

    Is it a specific nodetype, or does that vary too? If it's always the same nodetype, you could test on NodeTypeAlias.

  • Bjørn Fridal 274 posts 784 karma points
    Aug 30, 2011 @ 09:32
    Bjørn Fridal
    0

    Hi Berntsen,

    It is a specific node type. To be precise it goes like this Product > Product Variant Group > Product Variant.

    So if a match is made in Product Variant the Product node needs to be returned. I have tried making the xpath query using nodetypealias but without any luck.

  • Rich Green 2246 posts 4008 karma points
    Aug 30, 2011 @ 09:40
    Rich Green
    0

    Hi Bjorn,

    A possible/work around solution would be to add a "RedirectToParent" template for all your nodes without templates, then when the currently "Templateless" nodes are returned in the search then the user would get automatically redirected to the correct node when viewing it.

    Rich 

  • Bjørn Fridal 274 posts 784 karma points
    Aug 30, 2011 @ 09:45
    Bjørn Fridal
    0

    Hi Rich,

    Yes you're right. Currently I do a conditional on each search result and if its a Product Variant I simply use the grandparent Product node. However the problem with this solution and yours, is that it opens up to multiple of the same search result being displayed. A search query may match 5 Product Variants under the same Product, and then that product would be displayed 5 times in the search results.

  • Rich Green 2246 posts 4008 karma points
    Aug 30, 2011 @ 09:51
    Rich Green
    0

    Hey Bjorn,

    Got you.

    You could always get to the last result (which should be comma separated node id's if I remember rightly) and then strip out the duplicate id's using 'RemoveDuplicateEntries' from http://ucomponents.codeplex.com/wikipage?title=Strings&referringTitle=Documentation ?

    Rich

  • Rich Green 2246 posts 4008 karma points
    Aug 30, 2011 @ 09:52
    Rich Green
    0

    When I say 'last result' I mean the variable in xsltsearch just before it gets displayed.

    RIch 

Please Sign in or register to post replies

Write your reply to:

Draft