Copied to clipboard

Flag this post as spam?

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


  • Chris Evans 137 posts 353 karma points c-trib
    Aug 25, 2015 @ 17:07
    Chris Evans
    0

    Single quote / apostrophe in search term returns no results

    This is possibly a simple issue, but just wanted to check whether it is a known problem - couldn't find anything else on the ezSearch forum about it.

    When searching for a term that contains an apostrophe, like: St John's

    No results are matched, even though in the site there is a node named "St John's" that also has several fields, like bodyText, containing the same phrase multiple times.

    Is there something in the Examine ruleset that prevents single quotes from being indexed, perhaps because it is a reserved character? Does anyone know if there a way to have it included and matched as a valid search term, seeing as, well, it is valid content (additionally, "St Johns" doesn't match and returns zero results).

  • ME 2 posts 75 karma points
    Jan 08, 2016 @ 19:41
    ME
    3

    I finally managed to solve this issue by going into the ezSearch file under Developer >> Partial View Macro Files. About a quarter way down the page there's a line that looks like this groupedOr.AppendFormat("{0}:{1}* ", searchField, term); if you add 2 escaped quotes so the code looks like groupedOr.AppendFormat("{0}:\"{1}*\" ", searchField, term); you can successfully search with an apostrophe (and a few other special characters).

    Hope this helps

  • MikeD 92 posts 112 karma points
    May 25, 2017 @ 21:27
    MikeD
    0

    I have been searching for this answer all damned day! lol

    I would call this a bug and this is the fix for it. If anyone is watching, can we get that changed in the installer please? lol

  • Raghav 34 posts 103 karma points
    Feb 24, 2016 @ 11:13
    Raghav
    0

    Hi,

    I am also using Examine search and having the same issue. Can you please guide where exactly is this file located. Not able to find it at the path you mentioned. Just to add I am using the core examine api but still I do not get the results if there is an apostrophe.

    Thanks Raghav

  • ME 2 posts 75 karma points
    Oct 04, 2016 @ 16:59
    ME
    0

    Hi, Sorry for the late response. I forgot to mention that it's in Umbraco under the developer tab then you should see the Partial View Macro Files folder which contains the ezSearch file. For me the code is on line 125 so yours should be close to there.

  • MikeD 92 posts 112 karma points
    May 25, 2017 @ 21:28
    MikeD
    0
            // Ensure page contains all search terms in some way
        foreach (var term in model.SearchTerms)
        {
            var groupedOr = new StringBuilder();
            foreach (var searchField in model.SearchFields)
            {
    //          groupedOr.AppendFormat("{0}:{1}* ", searchField, term);
                groupedOr.AppendFormat("{0}:\"{1}*\" ", searchField, term);
            }
            query.Append("+(" + groupedOr.ToString() + ") ");
        }
    
Please Sign in or register to post replies

Write your reply to:

Draft