Sort results by "most relevant" - MYSQL and PHP

I have never considered this question before and wondered if anyone has any recommendations or recommendations on the best methods for achieving “relevant results”.

In my case, I run a search query that includes a full text search in 5 fields, a geographic radial search and a series of basic comparisons.

I can prioritize the fields that interest me the most in this example.

When searching for keyword X

  • Filter results by geographic search.
  • If the keyword is found in “base comparisons,” then these results should be first.
  • Then run the results if the keyword is found in the "full keyword search".

Would there be a better way to take an array of PHP results, turn it into an object, and then compare and sort before displaying?

+3
source share
1 answer

You can try using Sphinx

+6
source

Source: https://habr.com/ru/post/1768608/


All Articles