Advanced search functionality

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-05-03T19:57:01Z Indexed on 2010/05/03 20:08 UTC
Read the original article Hit count: 266

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql