Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6660707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:11:19+00:00 2026-05-26T02:11:19+00:00

I am creating an online FAQ type system using php and mySQL. The following

  • 0

I am creating an online FAQ type system using php and mySQL. The following SQL is what is used to find relevant questions based on what the user entered as $term.

When a user searches for something and clicks on a relevant question to display the answer they get the chance to rate the question given based on what they searched for.

The first part of the SQL gets relevant question ID’s from the actual questions table. The second part looks at the ratings table and tries to match what people have previously searched for to find relevant question ID’s.

The union of these results is then used to get the actual question titles stored in the database.

(SELECT id_question, 
MATCH(question, tags) AGAINST ('%$term%') as rank
FROM question
WHERE MATCH(question, tags) AGAINST ('%$term%')
AND category = '$category')

UNION

(SELECT id_question,  
MATCH(customer_search_query) AGAINST ('%$term%') as rank
FROM rating
WHERE MATCH(customer_search_query) AGAINST ('%$term%')
AND (customer_rating = 1))
ORDER BY rank DESC LIMIT 5;");

The problem I’m having is the system isn’t really learning correctly. For example, if I type “three users”, the system will find a match in the questions table.

If I type “3 users”, the system will find a match in the questions table (based on the keyword “users”). If I click “yes this answered my question” it will store “3 users” in the ratings table associating it with the question “three users”.

The issue is that “3” only becomes associated with “three users”. Is there a way to associate the number 3 in this case with every instance of the word “three”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:11:20+00:00Added an answer on May 26, 2026 at 2:11 am

    You don’t use wildcards in match against in natural language mode (the default).

    Use this query instead:

    (SELECT id_question, 
    MATCH(question, tags) AGAINST ('$term') as rank
    FROM question
    WHERE MATCH(question, tags) AGAINST ('$term')
    AND category = '$category')
    
    UNION ALL   <<-- faster than UNION.
    
    (SELECT id_question,  
    MATCH(customer_search_query) AGAINST ('$term') as rank
    FROM rating
    WHERE MATCH(customer_search_query) AGAINST ('$term')
    AND (customer_rating = 1))
    ORDER BY rank DESC LIMIT 5;");
    

    You can use search modifiers in boolean mode.

    Also match against will not search for stopwords and words shorter than 4 chars.
    You when you use $term = "3 users", MySQL will only look for users and ignore the 3.

    If you want to search for 3 you’ll have to revert to LIKE '% 3 %'

    See:
    http://dev.mysql.com/doc/refman/5.5/en/fulltext-boolean.html
    http://dev.mysql.com/doc/refman/5.0/en/fulltext-stopwords.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating an online based system that has public user profiles for all users..
I'm looking for a tutorial that outlines creating an online quiz using jQuery, PHP
I'm creating an online game in PHP where users can create playable characters. Each
I am creating an online tutor concept based site in django. I am stuck
I'm Creating a website for online reading stories using grails and i'm facing a
So I am creating a small online quiz application with jQuery and PHP ...
I am creating timed online test in C# asp.net. I have created it using
I am creating an online booking system & need to exclude closed days from
I am creating an online booking system & need to exclude closed days from
Which modules can be used for creating an online store in drupal?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.