Lukas W.
Well-known member
I'm working on an autocomplete functionality that gives a bit more freedom and is capable of doing a better search than a static search with MySQLs 'LIKE' by using the levenstein distance.
The current query is:
I know this would be potentially possible to achieve by using an engineered SQL clause to search for everything with a levenstein distance smaller than a given threshold. But that is not as forgiving as I'd like to have it. If instead, I would be able to sort by the distance in ascending order, that would deliver better results. Is there a way to do this or would I need to run a direct SQL query?
The current query is:
PHP:
$finder
->where('font_id', 'like', $finder->escapeLike($q, '%?%'))
->active()
->fetch(10);
I know this would be potentially possible to achieve by using an engineered SQL clause to search for everything with a levenstein distance smaller than a given threshold. But that is not as forgiving as I'd like to have it. If instead, I would be able to sort by the distance in ascending order, that would deliver better results. Is there a way to do this or would I need to run a direct SQL query?