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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:32:42+00:00 2026-06-13T15:32:42+00:00

Scenario : I have 5 tables all which need to be searched. I have

  • 0

Scenario:

I have 5 tables all which need to be searched. I have proper full text indexes (indices?) for each. I can search each individually using MATCH and AGAINST, and ordering by their relevance scores.

The problem is I want to combine and interweave the search results of all 5 tables and base it off of relevance score. Like so:

(SELECT *, MATCH(column) AGAINST (query) as score
FROM table1
WHERE MATCH (column) AGAINST (query))
UNION
(SELECT *, MATCH(column) AGAINST (query) as score
FROM table2
WHERE MATCH (column) AGAINST (query))
UNION
...
ORDER BY score DESC

This works well and dandy except that table 1 may have twice as many rows as table 2. Thus, since mySQL takes into account uniqueness for relevance, the score for results of table 1 are most often significantly higher the results of table 2.

Ultimately: How can I normalize the scores for the results from the 5 tables of varying size if I want to weight results from each table equally?

  • 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-06-13T15:32:43+00:00Added an answer on June 13, 2026 at 3:32 pm

    Your UNION‘ing of the results from the five tables makes me believe you probably should merge the five tables into a single one (with perhaps an additional column that identifies the one of five types of data, currently spread in five tables).

    Similarly, you could store just the text column in one single table, like this one :

    CREATE TABLE text_table (
        text_col TEXT,
        fk INT, -- references the PK of an item in either table1, or table2, or...
        ref_table INT, -- identifies the related table, e.g. 1 means 'table1', etc.
        FULLTEXT INDEX (text_col)
    )
    

    Then you could run the full-text seach on this table. JOIN‘ing the results with the actual data tables seems to be straightforward.

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

Sidebar

Related Questions

In a pretty typical scenario, I have a 'Search' text box on my web
Here's my scenario: I have two tables A, B which (for the sake of
This is my scenario: I have two different tables: Table 'subscriptions' contains all the
Scenario: I have multiple text boxes in which a user will enter data into
Here's the scenario: I have 2 tables with data, one is the 2009 version
Here's the scenario: I have 2 tables: CREATE TABLE dbo.API_User ( id int NOT
Here is my scenario: I have two MySQL tables: Categories (columns: id, category) Items
Scenario I have an TWO datbase tables of exactly the SAME STRUCTURE. The difference
I have a scenario and I really need your help. I have a Silverlight
I have a scenario in a system which I've tried to simplify as best

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.