Copied to clipboard

Flag this post as spam?

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


  • Adam Gill 2 posts 72 karma points
    Nov 29, 2017 @ 12:41
    Adam Gill
    0

    Examine - search child nodes to return parent nodes

    Hi All,

    I am trying to return a list of nodes by querying child nodes.

    For example my content is like so (node alias in brackets):

    Trips:

    • Cruising the River Kwai (Trip)
      • Hanoi (Related Location)
      • Vietnam (Related Location)
      • River Kwai (Related Location)
    • 3 Day Tour round Bangkok (Trip)
      • Bangkok (Related Location)
      • Thailand (Related Location)
    • Cycling in Battambang (Trip)
      • Vietnam (Related Location)
      • Battambang (Related Location)

    I am aiming to return a list of trips say on a country or city page; i.e. have a Vietnam page that would list out the first and last trip. So I need to query the Related Locations to return a unique list of trips that are relevant.

    I have this working using the IPublishedContent interface, but it is slow (even for a handful of trips).

    Is anyone able to give me some pointers as to how to construct an Examine search work for this?

    Thanks! Adam

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Dec 27, 2017 @ 12:04
    Alex Skrypnyk
    0

    Hi Adam

    I think that xPath is your friend in this situation, please, have a look at "Common Pitfalls" article - https://our.umbraco.org/documentation/reference/Common-Pitfalls/#xpathnodeiterator-for-when-you-need-direct-xml-support

    You can query Trips with xPath like it's described in the article

    Thanks,

    Alex

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Jan 14, 2018 @ 20:42
    Alex Skrypnyk
    0

    Hi Adam

    Did you solve the issue? Please, share with community/

    Oleksandr

Please Sign in or register to post replies

Write your reply to:

Draft