Hello
I have a problem with my search code.
I wanted to have boolean search for exact phrases, ranked by relevance - I looked around and found that this query worked..
$query = "SELECT *,MATCH (col1, col2) AGAINST ('var')
AS relevance FROM Table1 WHERE MATCH (col1, col2) AGAINST ('+var' IN BOOLEAN MODE)";
So search for "var1 var2"" results in rows with only var1 and var2 together.
However, if I use this query, the search queries without double quotes "" (i.e. var1 OR var2) are NOT ranked by relevance. I want that if a user puts var1 var2 as search variables, the rows which have var1 and var2 should be displayed before the rows with either of these.
Is there a best of both worlds way to do this - I mean boolean search queries for exact phrases ("var1 var2"), ranked by relevance, as well as inexact search queries (var1 var2), ranked by relevance too?
Please help. Thanks!