Jump to content

Sorting Search Results By Relevance


frankieJr
 Share

Recommended Posts

Hello all,i have a search function that allows users to search by keywords.. the results i get is okay but i need to sort it based on relevance .. meaning if a user search for "red fresh apple" he/she gets the results of all entries having those words but sort it starting from the entries having all 3 .. then at least 2 matched .. and finally entries with at least 1 word match.here is the sql query im using:mysql_query("SELECT id FROM autos WHERE MATCH (ad_title, ad_desc, make, model) AGAINST ('$search' IN BOOLEAN MODE)");please help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...