I have a website with a jQuery based autocomplete search functionality which works great.
Currently though I have just one search box for all categories, what I want is for someone to be able to type in, say for example, dorian gray dvd
(in any order) which will search for dorian gray
within the dvd
category. What this will require then is a bit of magic on the server side to figure out if any of the words are category keywords, and then limit the search by that.
What is the best (and quickest) way to do this in PHP / MySQL?
I currently have a few trains of thought
- Search the category table for matches and perhaps order the results by that.
- Or split up the search terms into an array and separately search the categories for that for a match.
- Another thought I just had is to concat the category title to the dvd title in the database and match against that, or something similar... but this sounds computationally expensive?
Any advice?