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).
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).
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.
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.
// 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() + ") ");
}
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).
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 likegroupedOr.AppendFormat("{0}:\"{1}*\" ", searchField, term);
you can successfully search with an apostrophe (and a few other special characters).Hope this helps
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
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
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.
is working on a reply...