Copied to clipboard

Flag this post as spam?

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


  • bparks 23 posts 79 karma points
    Dec 16, 2011 @ 08:57
    bparks
    0

    Limit Examine Search Results to Specific Nodes

    Our content tree is set up as follows:

    Node A
    -- Node B
    ---- Node 1
    ---- Node 2
    -- Node C
    ---- Node 3
    ---- Node 4

    We would like to allow the user to search at various levels in the tree.
    For example, if the user is searching in the "Node C" context, only return search results found in Node 3 and Node 4.
    If the user is searching in the "Node A" context, we would return search results for any of Node A's descendants matching the search query.

    Any suggestions on the best way to do this?  Is this something that can be accomplished with the Fluent API, or will we need to loop through the search results and perform the filtering after the results are returned?

    Using version 4.7.1.

    Thanks.

  • Owen 123 posts 246 karma points
    Dec 16, 2011 @ 09:13
    Owen
    0

    Store the node path into index, such as node path for NodeA is /NodeA, and node path for NodeC is /NodeA/Nodec etc.

    Then you can use node path of current search context to get proper nodes( Use PrefixQuery).

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Dec 16, 2011 @ 12:32
    Ismail Mayat
    0

    bparks,

    I have done this on a few projects by injecting the path into the index by replacing the , in the existing path using gatheringnode event then you can filter so that the path you pass into search can be used as filter. You already have in the index field called path looks like -1,1366,1367,1375 etc so in new field call it searchablePath replace , with space so you have -1 1366 1367 1375 you can then use a start node as filter on searchablePath.

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft