Copied to clipboard

Flag this post as spam?

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


  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Aug 04, 2015 @ 11:59
    Jesper Ordrup
    0

    Some feedback

    Hi Matt,

    We installed eZsearch and ran into a few problems.

    The indexer breaks under certain conditions. In ezSearchBootstrapper.cs

    e.Fields["umbracoFileName"] = Path.GetFileName(e.Fields["umbracoFile"]);
    

    This line throws an exception when the field is a cropper. I just added an exception handling:

    var uFile = e.Fields["umbracoFile"] as dynamic;
    
                    try
                    {
                        e.Fields["umbracoFileName"] = Path.GetFileName(uFile);
                    }
                    catch (System.Exception)
                    {
                        var x = new System.Web.Script.Serialization.JavaScriptSerializer().DeserializeObject(uFile)["src"];
                          e.Fields["umbracoFileName"] = Path.GetFileName(x);
                    }
    

    When rendering the results in ezsearch.cshtml the helper "RenderResults" breaks when trying to create urls to media folders.

    I added a try catch and a check

      try
                    {
                        switch (result.Fields["__IndexType"])
                        {
                            case UmbracoExamine.IndexTypes.Content:
                                var contentItem = Umbraco.TypedContent(result.Fields["id"]);
                                @RenderContentResult(model, contentItem)
                                break;
                            case UmbracoExamine.IndexTypes.Media:
    
                                if (result.Fields["nodeTypeAlias"] != "folder")
                                {
                                    var mediaItem = Umbraco.TypedMedia(result.Fields["id"]);
                                    @RenderMediaResult(model, mediaItem)
                                }
    
                                break;
                        }
                    }
                    catch (Exception)
                    {
    
    
                        // need some logging of errors here?
                    }
    

    There's probably some other build in ways to do this. :)

    /Jesper

Please Sign in or register to post replies

Write your reply to:

Draft