Sorting data by relevance, from multiple tables

Posted by Oden on Stack Overflow See other posts from Stack Overflow or by Oden
Published on 2010-05-31T14:09:14Z Indexed on 2010/05/31 14:13 UTC
Read the original article Hit count: 282

Hey,
How is it possible to sort data from multiple tables by relevance?

My table structure is following:
I have 3 tables in my database, one table contains the name of solar systems, the second for e.g. of planets. There is one more table, witch is a connection between solar systems and planets.

If I want to get data of a planet, witch is in the Milky Way, i post this data to the server, and it gives me a multi-dimensional array witch contains:

  1. The Milky Way, with every planet in it
  2. Every planet, witch name contains the string Milky Way

(maybe thats a bat example because i don't think that theres but one planet with this name, but the main concept is on file)

But, i want to set the most relevant restaurants to the top of the array. (for the relevance i would check the description of the restaurants or something like that)

So, how would you do that kind of data sorting?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about search