<blockquote>
  <p>Is there an easy/quick way to do this without using an external service?</p>
</blockquote>

<p>Nothing easy I can think of.</p>

<p>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 <code>craft_searchindex</code> table, using full text wildcards as necessary for fuzzy searching the beginning and ending of a string.</p>

<p>It looks like the closest thing that MySQL has that might do what you're looking for is <a href="https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_soundex" rel="nofollow noreferrer">SOUNDEX()</a>, but 1) Craft doesn't use that and 2) it doesn't appear that SOUNDEX can be used against full text indexes.</p>

<p>Keep in mind (just like <a href="http://squarebit.co.uk/software/craft/searchplus" rel="nofollow noreferrer">Search Plus</a>) any solution you find is only going to affect front-end searches (not in the CP).</p>

<p>You should add a thumbs-up/comment to this feature request if you'd like to see that change: <a href="https://github.com/craftcms/cms/issues/833" rel="nofollow noreferrer">https://github.com/craftcms/cms/issues/833</a></p>

CC BY-SA 3.0
2017-05-18T21:39:01.807Z
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
CC BY-SA 3.0
2017-05-18T22:33:00.437Z
I'm sorry to have disappointed you, Paul.
Brad Bell
CC BY-SA 3.0
2017-05-19T06:35:02.960Z
Never mind, Brad. I'll live.
Paul
CC BY-SA 3.0
2017-05-18T21:29:46.887Z
2017-05-18T21:29:46.887Z
Brad Bell
<p>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 <a href="http://squarebit.co.uk/software/craft/searchplus" rel="nofollow noreferrer">plugin</a> for that, but before I pay Algolia for it, I would like to know:</p>

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

<search>
Search by close match
# Search by close match

(Asked by: username_0 on 2017-05-18)

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](http://squarebit.co.uk/software/craft/searchplus) 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?

**Tags:** search

---

## 1 answers

### Answer by username_1 on 2017-05-18. Score: 0 | Accepted answer

> 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()](https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_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](http://squarebit.co.uk/software/craft/searchplus)) 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>

> **Comments:**
> **username_0**: 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.  
> **username_1**: I'm sorry to have disappointed you, Paul.  
> **username_0**: Never mind, Brad. I'll live.  

---

