Jump to content


Photo

Sitewide Search - Requiring Multiple Tables


  • Please log in to reply
2 replies to this topic

#1 1internet

1internet

    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 26 November 2012 - 08:28 PM

I want to be able to search my entire site over all the tables, e.g. restaurants, entertainment, hotels, etc.
How is this done?
Also what if I wanted to search through more than one clolumn, e.g. title and body, and then further, what if I wanted to rank the ones that contained the search query in the title, ahead of the ones in the body?

#2 parkerj

parkerj

    Advanced Member

  • Members
  • PipPipPip
  • 167 posts
  • LocationBoston, MA

Posted 26 November 2012 - 09:21 PM

To get you started, your query could start as

mysql_query( "SHOW TABLES FROM name_of_database" );

or
mysql_query( "SELECT * FROM information_schema.`COLUMNS` C WHERE TABLE_SCHEMA = 'YOUR_DATABASE'" );

eduTrac ERP | College Management System


#3 fenway

fenway

    MySQL Si-Fu / PHP Resident Alien

  • Moderators
  • 16,194 posts
  • LocationToronto, ON

Posted 30 November 2012 - 12:36 AM

You want a proper fulltext index -- MySQL isn't really good at that -- check out Sphinx.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com