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

  • Home
  • SEARCH
  • 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 7192965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:04:19+00:00 2026-05-28T20:04:19+00:00

I have a table called indx_0 where I select all pid (product id) cominations

  • 0

I have a table called indx_0 where I select all “pid” (product id) cominations with “wid” (word id) grouping them by products that match the most words. Now, since the actual words are stored within a different table called “windex” the table indx_0 only contains product ID matched with the ID of the word.

Here is the current query I use to get the results.

SELECT pid, count(*) WordMatchCount
   FROM indx_0 
   WHERE wid in ( 294, 20591, 330 )
   group by pid
   order by WordMatchCount desc
   limit 1000

Say I search for “ddr memory card” I will NOT get the result that contains “ddr3” prioritized over any other keyword since it searches for exact match. so “ddr memory card” and “phone memory card” would be treated as equal since neither “ddr3” nor “phone” equals to ddr.

I want to use join and LIKE (or any other preferable way) to allow “ddr” match against “ddr3” or “ddr2” very closely to prioritize it over other results where there is no close match.

Here are table structures:

CREATE TABLE IF NOT EXISTS `windex` (
  `word` varchar(64) NOT NULL,
  `wid` int(10) NOT NULL AUTO_INCREMENT
  PRIMARY KEY (`wid`),
  UNIQUE KEY `word` (`word`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=834922 ;

CREATE TABLE IF NOT EXISTS `indx_0` (
  `wid` int(7) NOT NULL,
  `pid` int(7) NOT NULL,
  UNIQUE KEY `wid` (`wid`,`pid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Is this possible?

thank you!

  • 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-28T20:04:20+00:00Added an answer on May 28, 2026 at 8:04 pm

    If you’re filtering by word id, you’re obviously not getting close matches. Every ID has a specific word. What you want is to query the IDs directly from windex and looking for the matches in indx_0.

    SELECT i0.pid, count(*) WordMatchCount
    FROM indx_0 AS i0
    LEFT JOIN windex AS wi ON (wi.wid = i0.wid)
    WHERE wi.word REGEXP '(.*)ddr(.*)|(.*)memory(.*)|(.*)card(.*)'
    group by i0.pid
    order by WordMatchCount desc
    

    I’d make sure to run EXPLAIN and index the appropriate columns, though.

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

Sidebar

Related Questions

Hi I have table called Sold Products which stores buying information for product &
I have table called 'shipped_data' https://i.stack.imgur.com/JXBej.png and need go get all 'caseNumbers' that match
Have a table called user_products that contains a record for each product the user
I have a Table called Product and I have the Table StorageHistory . Now,
I have a table called USERS that has a foreign key to the table
I have a table called Movies i want to select some columns from it
I have a table called Review and i want to retrieve all review objects
I have table called product review with columns productreviewid , productid , shopperid ,
I have a table called Schedule that serves as a queue mechanism for multiple
I have table called Table A and I have created a trigger that handles

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.