Advanced search with mysql
I am creating a search function for my site where the user can put whatever they like in a text box. It matches anything (name, title, job, car make, ... you name it)
I originally wrote a query with an INNER JOIN on each table that needed to be searched.
SELECT column1, column2, ... FROM person INNER JOIN person_car ON ... INNER JOIN car ...
It ended up in a query with 6 or 8 INNER JOINs and an integer WHERE ... LIKE '% searchvalue%'
Now this request is causing a timeout in MySql and I even got a warning from my hosting provider that the requests are simply taking up too many resources.
Now, obviously I am doing it very wrongly, but I was wondering how to properly approach such search functionality.
+2
a source to share
2 answers