thesavior
04-25-2009, 11:12 PM
Im trying to write a forum search using MYSQL's fulltext feature.
My goal is to be able to search multiple tables, order the results by relevance and display them.
So if I have the tables Users, Topics, and Posts lets say a user searched for the word Forum
It would look in all the tables Users (username/displayname), Topics (title) and Posts (message)
and order them by relevance.
So that query would allow me to return on my page something like:
User: Forum
Topic: Forums
User: I R FORUM
Post: blah blah forum
Post: blah blah forum blah
Topic: This forum is totally awesome!
User: forumname is lame
I know how to do this for each table, but I want to have the tables connected and ordered by relevance.
This is similar to facebook's search. If you search for a term, it will look in users, groups, events, applications, pages, etc and display the results based on relevance.
My goal is to be able to search multiple tables, order the results by relevance and display them.
So if I have the tables Users, Topics, and Posts lets say a user searched for the word Forum
It would look in all the tables Users (username/displayname), Topics (title) and Posts (message)
and order them by relevance.
So that query would allow me to return on my page something like:
User: Forum
Topic: Forums
User: I R FORUM
Post: blah blah forum
Post: blah blah forum blah
Topic: This forum is totally awesome!
User: forumname is lame
I know how to do this for each table, but I want to have the tables connected and ordered by relevance.
This is similar to facebook's search. If you search for a term, it will look in users, groups, events, applications, pages, etc and display the results based on relevance.