Copied to clipboard

Flag this post as spam?

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

  • Niels Lynggaard 175 posts 472 karma points
    Feb 08, 2017 @ 07:45
    Niels Lynggaard

    Help with raw examine query to limit the results by path

    Hi All!

    I've created an eventhandler that hooks into the "OnGatheringNodeData" and adds a field to my index, called "searchPath", wich is basically path with replace ", " with " ", (As seen here;

    That works perfectly and the field is inserted into my index.

    However, I can't get my raw query to limit to a specific site properly. I've looked at the way ezsearch does this, and so my query is made from a string; Example;

     -hideInSearch:1 +(__IndexType:content searchPath:2604 -template:0) +(headline:reach* bodyText:reach* teaser:reach* gridLayout:reach* ) headline:reach*^4 bodyText:reach*^3 teaser:reach*^2 gridLayout:reach*^1

    But that query still finds stuff located on other sites, e.g; doesn't have "2604" in searchPath field.

    I've tried adding a "+" in front of "searchPath" but then I get no results (I tried the query in luke also..)

    Any idea what I'm doing wrong here? Cheers, Niels

  • Alex Brown 129 posts 617 karma points
    Feb 08, 2017 @ 16:00
    Alex Brown

    Have you tried using Path, rather than SearchPath?

    Apologies if I've not understood this, but the Path parameter lets you look under a certain node in Umbraco.

    Also, I think you may have to include the entire path of the node, for the parameter to work.

    E.g. if you want to exclude a node at the root it might be something like: path:-1,2604

    -1 being the root

  • Niels Lynggaard 175 posts 472 karma points
    Feb 09, 2017 @ 07:18
    Niels Lynggaard

    Hi Alex.

    Sorry, I wasn't completely clear on what it is that I want to accomplish. My problem is, that I have an umbraco installation with many sites. So basically, I want to limit my search to a specific site on each site.

    Therefore, I'm trying to get the query to ONLY return results where some nodeid is in the path (The nodeID of the current page). All the logic around finding the proper nodeid etc. is in place, but the query returns results from the other sites, so I want to limit this. So the correct behaviour of my search should be to only return nodes that are under the current site.

    I Could just do a linq-query once the results are retrieved, but the solution would be much cleaner if the query only returned results with the ID in the path..

    the searchPath is basically just the same as "Path", with the comma's filtered out. Its a field that I create with a handler that hooks into the OnGatheringNodeData event, so this field is in the index.

    Thanx for taking your time to help! :)


Please Sign in or register to post replies

Write your reply to: