3

I'm looking for a way to get search results, even if people make typos, so apple as a result when looking for aple. Not fuzzy search, but some implementation of, for example, a Levenshtein function. I know I could go the Algolia way and that there's even a plugin for that, but before I pay Algolia for it, I would like to know:

  • Is there an easy/quick way to do this without using an external service?
  • If so, would you be willing to share your thoughts on the subject?
0

Is there an easy/quick way to do this without using an external service?

Nothing easy I can think of.

For Craft 2 (which only supports MySQL), Craft turns those search queries into a MySQL query that can take advantage of MySQL's Full Text Search indexes on the craft_searchindex table, using full text wildcards as necessary for fuzzy searching the beginning and ending of a string.

It looks like the closest thing that MySQL has that might do what you're looking for is SOUNDEX(), but 1) Craft doesn't use that and 2) it doesn't appear that SOUNDEX can be used against full text indexes.

Keep in mind (just like Search Plus) any solution you find is only going to affect front-end searches (not in the CP).

You should add a thumbs-up/comment to this feature request if you'd like to see that change: https://github.com/craftcms/cms/issues/833

3
  • I found SOUNDEX() indeed, but that's not cutting it. I will use one of my thumbs up to support the request for more advanced search features. – Paul May 18 '17 at 21:39
  • I'm sorry to have disappointed you, Paul. – Brad Bell May 18 '17 at 22:33
  • Never mind, Brad. I'll live. – Paul May 19 '17 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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