Jump to content

Recommended Posts

Hello,

 

I'm building a blog post website, and now I'm on the search part of it.

 

I have a search field which I instruct the user to type in "keywords" they want to search for. The words they type in there are then to be searched in the "title" and "content" of each post in the "posts" table.

 

Here's an example query of my current setup:

 

SELECT * FROM (`posts`) WHERE MATCH(title,content) AGAINST('+term1* ' IN BOOLEAN MODE);

 

This works fine if I have one or two words in they keywords. If I, however, copy and paste an entire sentence from an existing blog post, no results are found ???

Here's an example of a query where I just copy+pasted a sentence from a blog post:

 

SELECT * FROM (`posts`) WHERE MATCH(title,content) AGAINST('+Hello* +everyone* +my* +name* +is* +Bob* ' IN BOOLEAN MODE);

 

Yet, a search for just "Bob" returns the proper result. WHY? What's a better way to perform this search?!

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.