Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-14-2006, 04:49 PM   PM User | #1
bauhsoj
Regular Coder

 
Join Date: Jan 2005
Posts: 470
Thanks: 3
Thanked 0 Times in 0 Posts
bauhsoj is an unknown quantity at this point
Fulltext returning too many results

How do I get a fulltext search to return only records that contain all terms instead of records that contain any of the terms?

In other words, if I enter the search "blues clues" MySQL will only find records that contain the words "blues" AND "clues" without having to introduce special boolean search syntax.
bauhsoj is offline   Reply With Quote
Old 07-14-2006, 06:11 PM   PM User | #2
arnyinc
Regular Coder

 
Join Date: Jan 2003
Posts: 867
Thanks: 4
Thanked 8 Times in 8 Posts
arnyinc is an unknown quantity at this point
I think "in boolean mode" is your best bet. Just parse all the words based on the space character, trim them, then append a + sign to the front.

SELECT * FROM yourtable WHERE MATCH (booktitle) AGAINST ('+blues +clues' IN BOOLEAN MODE)
arnyinc is offline   Reply With Quote
Old 07-19-2006, 04:19 PM   PM User | #3
bauhsoj
Regular Coder

 
Join Date: Jan 2005
Posts: 470
Thanks: 3
Thanked 0 Times in 0 Posts
bauhsoj is an unknown quantity at this point
Thanks....that did the trick!
bauhsoj is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 04:06 PM.


Advertisement
Log in to turn off these ads.