Channel data may contain ‘smart’ quotes/apostrophes, sometimes encoded. Yet site users naturally search using 'dumb' quotes. Therefore, supersearch may not find entries which ‘match’ the query!

Can anything be done about this?

3 Answers 3


Well, you are rather lacking any context or examples in your question, however I would recommend stripping characters like this, that could be confused, from the search term completely, go to primitive words. This way even if your results do have 'smart' quotes as you call them in them, the mathcing will be done on a no quotes basis.

as for extra's like 's and 'll ect, replace them with nothing "" so a search for rat's would be a search for rat, likewise a search for "rat' (notice the mismatched quotes) would also search for rat.

In the searched in fields, this will return results for rat, rat's, "rat's" or ratatatata!.

  • An interesting suggestion - though how do you replace them with nothing?
    – Zack
    Apr 13, 2015 at 9:25
  • An example would be a search for guardian's allowance, which may be in the data as guardian's allowance or guardian’s allowance or guardian’s allowance.
    – Zack
    Apr 13, 2015 at 9:28
  • Well as I said, without detail and example in the question I can only assume how your doing this, but I would be inclined to handle the POST from the search form with PHP, and use functions such as php.net/str_replace in the array mode to replace multiple strings. Use functions like explode to get your words, you might even wish to create a regular expression to clean the input words...
    – Blatant
    Apr 13, 2015 at 9:38
  • Also, you do realise if your using E's native search a bit of wod filtering and cleaning happens automatically? Check out /system/expressionengine/helpers/search_helper.php the function sanitize_search_terms is executed on searching, this strips tags, 'disallowed' characters and cleans nasty stuff. Also /system/expressionengine/modules/search/mod.search.php which does the searching converts things to entities as well. I'd guess SuperSearch does something similar, so check that out. If you want to you could write an extension that overloads the Search helper so you could clean it yourself.
    – Blatant
    Apr 13, 2015 at 9:48
  • I think Supersearch does indeed do something similar, I'm just not sure what it is or how to change it. I was hoping maybe this was a solved problem - I can't believe noone else has come up against it. Maybe someone from Solspace could chip in?
    – Zack
    Apr 13, 2015 at 17:22

Well, looking plainly for an answer for you, we can do something about it, but it's not an _easy 'turn this on'. there is some common sence cleaning already happening.

What we'll have to do is submit the form to our own php action/code in a template. 'fiddle' with the words a bit, submit them to the relivent library (in this case supersearch). This is a process I've used before:

  1. Modify your search form to post to a different route/template
  2. Add a template here, use ee()->input->post() to get your posted string
  3. Add your PHP and recreate your sanitised search terms string
  4. Look into Supersearch's code, it will reveal the function the form normally posts to, call this function from your php code with your sanitised string.

You could of course also do this with Javascript. With jQuery you could hook the click event of the search forms submit, clean your string with JS and return true from the hook function (allowing the submit)...

  • Yes, thanks for that. I had originally thought about cleaning the strings with jquery (as we'd rather stick with a GET search) - it's just that assuming we have eg either guardian's or guardian’s or guardian’s in the entries, and a search for guardian is not the same thing, it's a bit less straightforward than I'd hoped...
    – Zack
    Apr 14, 2015 at 10:44

I'm assuming "dumb" synonymous to "curly", "fancy", or "typographic" quotes. Unfortunately there is little that can be done in this case: searches are done based on what is stored and present in the database. If you have data stored with a straight quote ', that is different, for a computer and MySQL query, to a curly/fancy/typographic/dumb quote . Super Search, and likely other search-based add-ons will see the character difference and not return the result.

Others might suggest modifying core files and code, but that is risky and can lead to even more complications (eg. not distinguishing between ' and is nice until you do want ' to be distinguishable when it's used as something else than an apostrophe). In any case, this non-distinction isn't currently possible with Super Search. Nevertheless, I suggest submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on. :) http://support.solspace.com/support/discussions

  • OK, thanks - will do. BTW would turning on fuzzy search help here, ie would it at least allow a search for guardian's to find guardian’s, too? (As well as guardian, which ideally we might not want to find, but might be acceptable!)
    – Zack
    Apr 15, 2015 at 8:53
  • I see someone has already requested this. So anyone else with this issue, please upvote here ;) support.solspace.com/support/discussions/topics/4000000262 - (NB the FR implies that fuzzy search is not a solution and does not treat all these quote variations the same.)
    – Zack
    Apr 15, 2015 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.