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 4032152
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:41:08+00:00 2026-05-20T11:41:08+00:00

Although this topic has been widely discussed, it left me very confused and I

  • 0

Although this topic has been widely discussed, it left me very confused and I haven’t been able to distill the correct answer. Could you please help me in the right direction? Thanks.

I’ve got this setup: table page is connected to table widgetby means of a reference table widget_to_page:

page (p)
sid | title | content
widget (w)
sid | content
widget_to_page (wtp)
sid | page_sid | widget_sid

I’ve created a fulltext index on p.title, p.content, w.content

Next up, I would like to the page-widget-combination:

SELECT *, MATCH(p.title, p.content, w.content) AGAINST("'.$keyword.'") AS score 
FROM page p, widget w, widget_to_page wtp
WHERE MATCH(p.title, p.content, w.content) AGAINST("'.$keyword.'")
AND p.sid = wtp.page_sid
AND w.sid = wtp.widget_sid
ORDER BY score DESC

Some remarks:

  1. This obviously doesn’t work… 🙂
  2. I’ve been reading that if I use this syntax to join the tables (or use a JOIN) statement, that it would cause MySQL to ignore the fulltext index. What is the correct method?

An alternative I’ve tried out was to create a MySQL view out of the following statement:

SELECT * 
FROM page p, widget w, widget_to_page wtp
WHERE p.sid = wtp.page_sid
AND w.sid = wtp.widget_sid

But this also does not seem to work. Some people speak of creating a fulltext index on this particular view, but I can’t find any options in PHPMyAdmin to do this and I do not know if this is even possible.

In short… what is the best practice in such a situation? Thanks.

  • 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-20T11:41:09+00:00Added an answer on May 20, 2026 at 11:41 am

    A FULLTEXT index can include multiple columns, but those columns have to be in the same table. So you will not be able to cover those 3 columns from 2 tables in a single index. You will need at least 2 indexes to accomplish that.

    Also, FULLTEXT indexes only work with the MyISAM storage engine, so if you are using a transactional engine like InnoDB this will not work. You should read the manual to learn about other features and limitations of fulltext indexes (including boolean mode, stopwords, etc.):

    http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html

    Assuming you are using MyISAM, you can create 1 fulltext index on (p.title,p.content) and another fulltext index on (w.content), then query the two indexes separately and use UNION ALL to combine the results.

    The resulting query will be something like this, but you’ll need to tweak it to meet your specific requirements:

    select page_sid, page_title, sum(score) as total_score
    from 
    (
    SELECT p.sid as page_sid,p.title as page_title,NULL as widget_sid, 
      MATCH(p.title, p.content) AGAINST("'.$keyword.'") AS score 
    FROM page p
    WHERE MATCH(p.title, p.content) AGAINST("'.$keyword.'")
    UNION
    SELECT p.sid as page_sid,p.title as page_title,w.sid as widget_sid, 
      MATCH(w.content) AGAINST("'.$keyword.'") AS score 
    FROM page p
      inner join widget_to_page wtp on p.sid = wtp.page_sid
      inner join widget w on w.sid = wtp.widget_sid
    WHERE MATCH(w.content) AGAINST("'.$keyword.'")
    ) as sub_query
    group by page_sid
    ORDER BY total_score DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Although topic has been discussed here before, but the proposed solutions don't seem to
There are many question regarding this topic but there is no clear answer. Although
I know this has been a hot topic over the time... but I can't
I know this topic has probably been done to death, but I've been unable
I have been researching this topic for a few days now and i'm still
I am using the answer in this topic. iPhone - how to determine carrier
Although I have research this topic I don't really seem to understand how to
Although this code is from an algorithm text, I have a bit of a
Although this is FAQ i still couldn't find a suitable solution. I'd like to
This is a follow on from my previous question although this is about something

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.