Mysql 按查询排序的全文搜索

Mysql 按查询排序的全文搜索,mysql,codeigniter,activerecord,Mysql,Codeigniter,Activerecord,我使用全文搜索来查找匹配的关键字。但它并没有给出正确的答案。我需要先找到max,然后再找到其他人。 它给我随机的结果。如何使用order max关键字匹配是第一位的?你的问题不清楚。你想创建实时搜索吗?@AbdulAhmadMatin是的,就像那样。我只需要获得最大匹配单词数就可以了。为什么不使用$this->db->like('name',$field)@AbdulAhmadMatin,如果用户搜索不正确的单词。我的意思是你已经在评论中写了为什么不使用if user search for wh

我使用全文搜索来查找匹配的关键字。但它并没有给出正确的答案。我需要先找到max,然后再找到其他人。
它给我随机的结果。如何使用order max关键字匹配是第一位的?

你的问题不清楚。你想创建实时搜索吗?@AbdulAhmadMatin是的,就像那样。我只需要获得最大匹配单词数就可以了。为什么不使用
$this->db->like('name',$field)@AbdulAhmadMatin,如果用户搜索不正确的单词。我的意思是你已经在评论中写了为什么不使用if user search for why you then like给了我正确的结果,但是如果用户搜索u; use why you _;则不可搜索。我使用全文搜索,它给我的结果,但不是像最大匹配词排序第一。
function _search($type, $qes, $sort = null, $start = 0) {
    $this->db
        ->select('id,name,frontCover,type,category,user,author,MRP,sellingPrice,isNew,isRaw,binding,publisherName,publicationYear')->from('books');
    $searchKey="";
    if(is_array($qes) && count($qes)>0){
        $searchKey = "+" . implode(" +", $qes);
    } 

    //full text search
    $searchKey = "MATCH name AGAINST ('".$searchKey."')";
    $this->db->where("(".$searchKey.")", NULL, FALSE);
    $this->db->where('status',1)->limit(30, $start);
    $query = $this->db->get();
    return $query && $query->num_rows() ? $query->result() : [];

}