Copied to clipboard

Flag this post as spam?

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


  • Jesp3r 4 posts 24 karma points
    Oct 14, 2014 @ 09:32
    Jesp3r
    0

    Searching for href values with Examine?

    I want to search for a href value with examine - more precise the 'locallink' value. Examine is straight out-of-the-box standard config.

    I have the following snippet which does not return any results;

    string searchQuery = "localLink:" + id;
    UmbracoHelper helper = new UmbracoHelper(UmbracoContext.Current);
    
    foreach (var result in helper.Search(searchQuery, false))
    {
        // Do something
    }
    

    Upon inspection of the index via Developer > Examine Management, I can see that the index does contain the value I am trying to search for but under a "_Raw" property. So I guess the question is, how I can make my search, search in these fields also?

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Oct 14, 2014 @ 10:55
    Ismail Mayat
    0

    Jesper,

    I am not sure when __Raw properties were introduced into Examine however when you look at the property using luke its value is type Stored that means its stored as a single token and not searchable the reason for having this property is for sorting purposes, although i am not sure when it was introduced for fields besides createDate and updateDate.  In answer to how you can search on it you would need to use gathering node data event and inject in a new field with that content.  I am not sure which index UmbracoHelper search uses however I am making the assumption its the internal index so you would need to implement on that.  

    Regards

     

    Ismail

  • Jesp3r 4 posts 24 karma points
    Oct 14, 2014 @ 11:44
    Jesp3r
    0

    Hi Ismail

    thx for clearing that up.

    Is there another way that i can loop throug all content in the backend searching for this string? I tried child.GetProperty("body").Value.Contains(query) but that returns published content, so 'locallink:xxxx' is altered to correct link. How could i get to the data before this step?

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Oct 14, 2014 @ 12:37
    Ismail Mayat
    0

    Jesper,

    I think in the internal index the content is not stripped of locallink have a look at the index using luke (https://code.google.com/p/luke/downloads/list) you could then write an examine search to find it. If its not in the content you would need to write gathering node event to put the content in with localink still in it. I think by default rich text edit fields have the html stripped out. So in gatheringnode get the content id and get icontent object and get the raw html and inject that in (You may need to html encode to stop it being stripped out).

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft