I am implementing a search feature for my project. I am using a FULL TEXT SEARCH
query to derive accurate results to User
. I am beginner in PHP
programming and I do not have enough information about FULL TEXT SEARCH
.
This is my query:
$sql = $conn->prepare("SELECT *, MATCH(title, keyword) AGAINST(? IN BOOLEAN MODE) AS relevance FROM table ORDER BY relevance DESC LIMIT 20");
$sql->bind_param("s", $q);
$sql->execute();
$rs = $sql->get_result();
This query works good but this is only showing old results first instead of accurate results, and second thing is this query is not working correctly when the length of keyword is not more than 1 (e.g. keyword = Google).
Please do not give suggestions about
Elastic search
,Sphinx
,Algolia
etc.