Reputation: 2310
I am working on a web application which has a full text search feature working without any problems. I would like to improve this and add a prediction/correction feature to it, meaning that if the user makes a typo or something which has 0 results, a corrected version of that input would get queried instead which has results. Basically somethig like Google's did you mean: x
feature.
Is there an easy built-in way in Laravel to do this, or anything useful to check? I have been Googleing the problem for some time now, but didn't find anything relevant.
I'm using Laravel 4.2 with a MySQL database, if that matters something.
Upvotes: 3
Views: 509
Reputation: 1946
For the similar case, I used elastic search for
Did you mean ...?
Elastic search does a lot more than this like it will sort relevant results on many different cases and many more. You can use Elasticquent for Laravel which implements elasticsearch to eloquent.
Upvotes: 1
Reputation: 500
There isn't anything built in. Initially I would look at integrating a spellcheck - there are a couple of packages available on packagist, although I don't know how well they perform
https://packagist.org/search/?q=spell
On a second level I guess you could store search terms in the DB and then do "People who searched for x also searched for y"
Upvotes: 1