Copied to clipboard

Flag this post as spam?

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


  • Andy Wilson 1 post 21 karma points
    Feb 08, 2014 @ 13:18
    Andy Wilson
    0

    ezSearch displaying no results

    I'm working on my first Umbraco project (v7.0.2) and having a problem with the ezSearch package displaying no results. I've tried using the macro with a variety of parameters and also the default search page (which is working on a local dev environment).

    I've installed the package using the same files on a local dev environment without a problem so I know thats not a problem. If I do a search in the Examin Management I get all the expected search results for the same term so know there is content for the search terms i'm looking at.

    When compairing what was installed in the dev environment and live environment it appears the /bin/Our.Umbraco.ezSearch.dll and /App_Code/ezSearchBoostrapper.cs wasn't included as part of the install. All files and folders are set to full permissions so can't see why not. I've tried uninstalling and reinstalling but get the same results. I've also tried manually copying both files across from the dev to live but thats not helped either. 

    Can anyone suggest possible next steps to get the search results outputting? Also anything that may prevent the .cs and .dll files from installing?

    Hope someone can help and many thanks in advance!

  • PRK 47 posts 119 karma points
    Feb 11, 2014 @ 11:52
    PRK
    0

    Hi,

    I had the same problem. My solution:

    @using System.Text
    @using System.Text.RegularExpressions;
    
    @{
                @* get culture root *@
                var root = Library.NodeById(@*find your root id*);
                var truncateOn = 150;
    
    
                if(!String.IsNullOrEmpty(Request["q"]))
                {
                    <div class="text-wrapper">
    
                        @if(root.Search(Request["q"]).Count() > 0)
                        {
                            foreach (var result in root.Search(umbraco.library.StripHtml(Request["q"]).ToString()))
                            {
                                @*filter your nodeTypes*@
                                if(result.NodeTypeAlias == "SomeThing")
                                {
    
                                    <div class="search-result">
                                        <a href="@result.Url">
                                            @result.Name
                                        </a>
    
                                    @{
                                            @*for every PageType with other content fields to display*@
                                            if(result.HasProperty("Some_Text"))
                                            {   
                                                @Html.Raw(Truncate(umbraco.library.RemoveFirstParagraphTag(result.GetProperty("Some_Text").Value),truncateOn )) 
                                            }
    
                                            if(result.HasProperty("Some_Other_Text"))
                                            {   
                                                @Html.Raw(Truncate(umbraco.library.RemoveFirstParagraphTag(result.GetProperty("Some_Other_Text").Value),truncateOn))    
                                            }
    
                                    <a href="@result.Url">
                                        @string.Concat("http://", umbraco.library.RequestServerVariables("HTTP_HOST"),@Library.NodeById(result.Id).NiceUrl)
                                    </a>
                                </div>
                            }
                        }
                    }
                    else
                    {
                        <p>
                            @Dictionary["Site.NoResultsFor"]&nbsp;<strong>@Request["q"]</strong>
                        </p>        
                    }
    
                </div>
            }
        }
    
        @functions
        {
            @*Truncates a string on word breaks and remove all tags*@
            public string Truncate(string input, int maxLength)
            {
                var truncated = Library.Truncate(Regex.Replace(input, "<.*?>", string.Empty), maxLength).ToString();
    
                if (truncated.EndsWith("&hellip;"))
                {
                    var lastSpaceIndex = truncated.LastIndexOf(' ');
    
                    if(lastSpaceIndex > 0)
                    {
                        truncated = truncated.Substring(0, lastSpaceIndex) + "&hellip;";
                    }
                }
    
                return truncated;
            }   
        }
    

    I`m sorry for the formatting. I have done my best. :-) Hope it helps.

  • Sean 12 posts 32 karma points
    Mar 25, 2014 @ 11:41
    Sean
    0

    PRK, sorry but I don't understand your solution, is this a replacement for ezSearch or a modification to the existing code?

  • PRK 47 posts 119 karma points
    Mar 25, 2014 @ 11:54
    PRK
    0

    Hi Sean,

    I've used the ezSearch code as a basis for my solution.

  • Sean 12 posts 32 karma points
    Mar 25, 2014 @ 12:51
    Sean
    0

    Thanks for the quick reply. So I can use this code instead of installing the ezSearch package?

  • PRK 47 posts 119 karma points
    Mar 25, 2014 @ 13:15
    PRK
    0

    Hi Sean,

    yes.

  • Sean 12 posts 32 karma points
    Mar 26, 2014 @ 10:02
    Sean
    0

    Thank you, I'm still persevering with ezSearch but now having a different issue ( http://our.umbraco.org/forum/developers/razor/49403-Error-when-ezSearch-razor-macro-is-rendering-a-FormlessPage-with-ajaxcontroltoolkit- ;) . Its good to know there is an alternative if I can't get ezSearch working.

  • rob alexander 5 posts 25 karma points
    Jul 23, 2014 @ 17:34
    rob alexander
    0

    Hi Sean, could you please explain the resolution to your original issue? 

    Having a similar problem with ezSearch in umbraco v7. It was working and giving results at first but now mysteriously keeps returning 'no results'.

    Thanks

  • Sean 12 posts 32 karma points
    Jul 27, 2014 @ 22:09
    Sean
    0

    Hi Rob, I'm sorry I gave up with ezSearch so never solved the issue.

  • Craig100 1136 posts 2523 karma points c-trib
    Mar 20, 2015 @ 18:30
    Craig100
    0

    I have the same problem with 7.2.2. as Rob

        var ezSearchOptions = new {
            PreviewLength = "100",
            SearchFormLocation = "TOP",
        IndexType = "CONTENT"
        };

    On my dev box I get good results with IndexType set to anything or even not there. In the test and live environments on an Azure server, I was getting results without the IndexType, but now I've changed it, I get nothing back at all with or without any IndexType.  I've rebuilt Examine indexes and they return results, but ezSearch doesn't return anything.

    Any advice appreciated

    Craig

  • Craig100 1136 posts 2523 karma points c-trib
    Mar 20, 2015 @ 20:26
    Craig100
    1

    Fixed it. It was because the sites are on Azure.

    http://issues.umbraco.org/issue/U4-5993

    Refers

    Craig

Please Sign in or register to post replies

Write your reply to:

Draft