Reply
best way to perform long, complex search
Old 05-23-2008, 02:24 PM best way to perform long, complex search
bez
bez's Avatar
Skilled Talker

Posts: 53
Trades: 0
Hi All

I have a MySQL table with the fields 'title' and 'description'.

I would like the user to be able to enter a string to an input box then search the table for any rows that contain the words entered in either the title or description. My question is, what is the best way to do it? (I guess its a pretty common requirement).

I have some further requirements:

-All terms must be searched for. I guess this means no 'full text' because of stopwords? I don't control the DB therefore cannot disable stopwords.
-I am using PHP bound queries. This means I have to statically define the number of variables, so I can't have something like 'title LIKE '%x%' AND title LIKE '%y%' AND title LIKE '%z%' as I don't know how many terms will be searched for.

The script is for a job I've applied for so the optimum, efficient solution is paramount.

Any ideas?
bez is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 05-23-2008, 03:33 PM Re: best way to perform long, complex search
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,674
Name: John Alexander
Trades: 0
If you can't do a million likes, it's going to be difficult. Either way, tho, you're going to force a table scan, and performance will suffer. This is because you would want to join Title Like '%some%' OR Title Like '%word%' and so on, with or operators, not ands. Most RDBM systems have trouble with or queries. Also with CLOB data types.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to best way to perform long, complex search
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.08546 seconds with 13 queries