Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
best way to perform long, complex search
Old 05-23-2008, 03: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
 
 
Register now for full access!
Old 05-23-2008, 04: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,662
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.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
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.10825 seconds with 12 queries