I've used Boolean Full-Text Searches to searches words from the database column. I want to get records that exactly match with my records & also including with wildcard search. I am getting the correct result but I want to set order of that result by exact match first. Is there any possible way to achieve this?
I want to perform a search on each word also & get records by relevancy.
I've tried using the following query but it doesn't work because it gives me the wrong rank for the records.
SELECT
id,
search_tags,
MATCH(search_tags) AGAINST(REPLACE(concat("'car'"," ")," ","* ") IN BOOLEAN MODE) AS relevance_rank
FROM
images
WHERE
MATCH(search_tags) AGAINST(REPLACE(concat("'car'"," ")," ","* ") IN BOOLEAN MODE)
ORDER BY relevance_rank DESC;
I expect the output of the query to be
id search_tag relevance_rank
11 car,cards,food,code 2.1669161319732666
12 car,water,sky 2.1669161319732665
13 carrier,food,drink 2.1669161319732664
, but the actual output is like
id search_tag relevance_rank1
11 carrier,food,drink 2.1669161319732666
12 car,cards,food,code 2.1669161319732666
13 car,water,sky 2.1669161319732666