Copied to clipboard

Flag this post as spam?

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


  • nojaf 91 posts 300 karma points
    Dec 16, 2013 @ 13:33
    nojaf
    0

    Examine, guid

    Hi there,

    I want the guid of a contentType to be indexed as well, when I query for stuff. I'll explain myself with some code:

    public DoSomethingWithContent(int id){
        IContent content = contentService.GetById(id);
        //Key is a guid
        Console.WriteLine(content.Key);
    }
    

    But now I'm in a situation where I don't have the id, but I do have the guid (don't ask why).

    public GetTheContentFromAGuid(string guid){
        //There is no method to do this with the contentService
        //So the plan is to index the guid and get my data with Examine
        var searcher = ExamineManager.Instance.SearchProviderCollection["MySearchIndex"];
        var searchCriteria = searcher.CreateSearchCriteria();
        var query = searchCriteria.Field("GuidKeyField", guid).Compile();
        var result = searcher.Search(searchCriteria).FirstOrDefault();
    }
    

    So what field do I need to add in my ExamineIndex.config so that the key would be indexed?

Please Sign in or register to post replies

Write your reply to:

Draft