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?
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.
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.
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.
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?
Is it a specific nodetype, or does that vary too? If it's always the same nodetype, you could test on NodeTypeAlias.
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.
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
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.
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
When I say 'last result' I mean the variable in xsltsearch just before it gets displayed.
RIch
is working on a reply...