Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
grahamgr3

In Boolean Mode Finding Words Within Forum Posts

Recommended Posts

I am trying to implement a search feature to a forum I am creating and I want users to be able to search through posts. So far users type in the search terms in a form, and they go through to my $_GET['terms'].

 

The problem is that the IN BOOLEAN MODE search only returns posts that start with or end with one of the search terms users type into the form. I want it so that the search can also return phrases that are within posts, not necessarily starting or ending with. I have tried the boolean mode operators in all sorts of ways but it doesn't work. Is it possible to use fulltext searches in this way, or should I try a different method. 

Here is my Mysql query I am using:

 

$terms = mysqli_real_escape_string($dbc, htmlentities(strip_tags($_GET['terms'])));

 

$q = "SELECT m.message, m.posted_on, s.thread_id, s.subject FROM posts AS m LEFT JOIN threads AS s USING (thread_id) WHERE MATCH (message, subject) AGAINST('$terms*' IN BOOLEAN MODE)";

 

 

Share this post


Link to post
Share on other sites

I'd like to see you start providing a lot more information when you post. For example, the MySQL version, table type, and indexes established would be meaningful here. As would some specific examples of what you've tried, what should happen, and what does happen. Otherwise we're all just guessing blindly, which isn't good for anyone.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...