Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Jul 03, 2012 @ 08:57
    Tom
    0

    Umbraco Examine 0.9.1.0 Under Umbraco 4.0.4.1 NullRef

    Hi All,

    I know it's an old version and there are issues with umbraco being this old.. but we patched alot of stuff in the build a while back when we first developed the site.

    We're running UmbracoExamine 0.9.1.0

    We're getting a Null Reference on:

     

    System.NullReferenceException: Object reference not set to an instance of an object.
       at UmbracoExamine.SearchResults.CreateSearchResult(Document doc, Single score) in C:\tomdev\umbracoexamine\UmbracoExamine\SearchResults.cs:line 32
       at UmbracoExamine.SearchResults.d__3.MoveNext() in C:\tomdev\umbracoexamine\UmbracoExamine\SearchResults.cs:line 59
       at System.Linq.Enumerable.d__81`1.MoveNext()
       at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
       at System.Linq.OrderedEnumerable`1.d__0.MoveNext()
       at System.Linq.Enumerable.d__3a`1.MoveNext()
       at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
       at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
    
    

    It's blowing up on this line

     

    var results = ExamineManager.Instance.Search(QueryParser.Escape(searchTermFromUrl.ToLowerInvariant()), 100, false)
                        .Distinct()
                        .OrderByDescending(r => r.Score)
                        .Take(100)
                        .Select(r => new Node(r.Id))
                        .Where(n =>
                        {
                            bool visible = (n.Id != 0 && n.template != 0);
                            if (visible)
                            {
                                var nodeHidden = n.GetProperty("umbracoNaviHide");
                                if (nodeHidden != null && nodeHidden.Value == "1")
                                {
                                    visible = false;
                                }
                            }
                            return visible;
                        });
    

    and as the stacktrace shows in the examine source (from reflector alas I don't have the source):

    private SearchResult CreateSearchResult(Document doc, float score)
    {
        SearchResult <>g__initLocal0 = new SearchResult();
        <>g__initLocal0.Id = int.Parse(doc.GetField("id").StringValue());
        <>g__initLocal0.Score = score;
        SearchResult sr = <>g__initLocal0;
        IList fields = doc.GetFields();
        if (CS$<>9__CachedAnonymousMethodDelegate2 == null)
        {
            CS$<>9__CachedAnonymousMethodDelegate2 = new Func(null, (IntPtr) b__1);
        }
        foreach (Field field in Enumerable.Where(fields.Cast(), CS$<>9__CachedAnonymousMethodDelegate2))
        {
            sr.Fields.Add(field.Name(), field.StringValue());
        }
        return sr;
    }
    

    I'm thinking doc.GetField("id") might be returning null..

    I've run the index through luke and at present can't seem to find anything glaringly obvious.. just wondering how i could get the examine source OR if anyone happened to have the same issues with the index occasionally blowing up..

    I know i could just set it to reindex and it'd fix the search term BUT im wanting to know why as it keeps happening periodically.

    Cheers, Tom

Please Sign in or register to post replies

Write your reply to:

Draft