Implementing Full-Text search using Laravel and TNTSearch
TNT Studio has a nice tutorial about implementing full-text search using Laravel and TNTSearch.
In this tutorial, we'll be using TNTSearch - a new powerful PHP package - to create a PHPUnit documentation!
Solving the search problem with Laravel and TNTSearch
Adding search functionality to your project can sometimes be tiresome. It is often required to search against large text documents where the database LIKE operator simply isn’t enough. It cannot handle cases where you don’t write the exact search query. The query “%Laravel — The PHP Framework%” is not the same as “%The PHP Framework — Laravel%” and often you won’t get any results for such queries. It’s not even worth discussing how much MySQL LIKE operator performance sucks.
You might argue that databases like MySQL have full text search support and it shouldn’t be to hard to use it. Well, you might be right, but this approach has also its down sides. If you’re not using the latest version of MySQL, you’ll see that there is no full text search support for InnoDB tables. If you have support, you won’t be able to search on multiple columns. The match queries are a little bit complicated and they don’t get you good results. Of course there are great solutions out there to handle full text search, most famous ones being Elasticsearch and Sphinx, but often they seem like just an overkill especially for “smaller” projects. >