Copied to clipboard

Flag this post as spam?

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


  • Mikkel Johannsen 32 posts 185 karma points
    Mar 21, 2016 @ 06:35
    Mikkel Johannsen
    0

    UmbracoExamine ParentID

    Hey there,

    First of all, I'm not entirely sure this is the right category, this is my first post so please excuse me if I'm not the most experienced forum user here.

    Anyway, I'm currently using UmbracoExamine for all project's search needs, and I'm trying to figure out what exactly the query-parameter ".ParentId" does.

    I was hoping I could use it to find all child nodes from a parentID, but I can't seem to get it working.

    Basically, if the searchstring contains e.g. "C# Programming", it should find all that category's articles. This is just an example.

    Thank you in advance!

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Mar 21, 2016 @ 08:22
    Ismail Mayat
    0

    Mikkel,

    The only way i have managed to get parent based searches to work is to inject into the index a searchable path. So we have path field it usually looks like -1,1,123,1234. I used gathering node data event and create new field called searchable path so the value in that field looks like -1 1 123 1234 because of the space character the field is tokenised and becomes searchable.

    You can then execute queries so if you wanted all children with parent 123 you can do .And("searchablePath","123")

    Regards

    Ismail

  • Mikkel Johannsen 32 posts 185 karma points
    Apr 06, 2016 @ 08:47
    Mikkel Johannsen
    0

    Hey Ismail,

    Sorry for getting back to you such a long while after your reply, I ended up simply getting all the results and then filtering them after fetching them, which works fine for this project as it'll have its own server dedicated to hosting it.

    Thanks for the answer though :)

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Apr 06, 2016 @ 09:01
    Ismail Mayat
    0

    Mikkel,

    Linq in memory filtering when you can filter using lucene causes kittens to die ;-}

  • Mikkel Johannsen 32 posts 185 karma points
    Apr 06, 2016 @ 09:03
    Mikkel Johannsen
    0

    Yeah no doubt, but it feels like injecting the searchable path is quite an overkill when I can live with the filtering afterwards. Hopefully they introduce parent-related searching in Umbraco Examine soon. Who knows :)

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Apr 06, 2016 @ 09:09
    Ismail Mayat
    0

    Mikkel,

    On an index you can set parentnode so only items in that folder get indexed just means you have to ensure all your items are in that folder.

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft