-1
I have a table as follows:
id|nota|titulo |ingredientes
1 | 3 |pão de batata|batata;farinha;agua;ovo
2 | 2 |bacalhoada |bacalhau;batata;pimentão
3 | 1 |batata frita |batata
When I do a search that contains the term 'potato" I want him to bring these three results, but first bring everyone who has potato in the title, then in descending order of the note, the criteria would be like this:
- Contains potato in the title
- Contains potato in the ingredient
- Sort in descending order of note
In this example, the result would be
- Potato bread
- French fry
- Codfish
What you want is to define a ranking by relevance, and you can achieve this by using an index fulltext for both columns
– Ricardo Pontual
You can sort based on the result of the 'like'. Maybe that’s what you are looking for: https://answall.com/questions/205331/como-order-pela-relev%C3%A2ncia-do-like and also: https://stackoverflow.com/questions/11144394/order-sql-by-strost-like
– Yan Rodrigues
Possible duplicate of How to sort by Like Relevance?
– HudsonPH