Reputation: 588
i want to sort the search results in order of relevance . we have a table containing a column for heading and a column for content. When a user tries to search the we use Like and OR Like to search in both the columns . But the search results generated are not in order of relevance as we want to prioritise the result matching the heading. so please if anyone can give any idea or hint for doing it in php and sql.
Upvotes: 0
Views: 79
Reputation: 113
you can sort results using your own function. you must create a function for this. exmpl;
function sortResults(results){
.
.
.
}
then sort your results in it.
Upvotes: -1
Reputation: 21292
You'd better look for the MySQL FULLTEXT
search functions, they are much better than LIKE
.
Upvotes: 3