0

ほどではありません。ここでは、動的な行と列を持つ1つのテーブルがあります。フルテキストインデックスを使用して1つの行に入力フィールドを検索すると、非常にゆっくりと来ています。ここでは、MYISAMとしてDBエンジンとして、FULLTEXT INDEXとしてテーブルの列として以下の値を設定しています。入力欄のデータを非常に速くしたい。ここで私は疲れたものを付けました。それを確認して私に知らせてください。codeigniterを使用したスピードフルテキスト検索インデックスは、CodeIgniterを使用して全文検索で問題が発生しているので、速度が

public function product_autocomplete() 
{ 
    $name_startsWith = $_POST['name_startsWith']; 
    $type = $_POST['type']; 
    $row_num = $_POST['row_num']; 
    $this->db->like('item_number', $name_startsWith); 
    $query = $this->db->select('item_id,item_number,name,tax_included,cost_price,categoryid,unit_price,supplier_id,quantity_received') 
    ->from('bgs_items') 
    ->where('MATCH (bgs_items.item_number) AGAINST ("'. $name_startsWith .'")', NULL, false) 
    ->limit(10) 
    ->get(); 
    $data = array(); 

    foreach ($query->result_array() as $row) 
    { 
    $name = $row['item_number']."-".$row['name'].'|'.$row['name'].'|'.$row['tax_included'].'|'.$row['cost_price'].'|'.$row['categoryid'].'|'.$row['unit_price'].'|'.$row['supplier_id'].'|'.$row['quantity_received'].'|'.$row['item_number'].'|'.$row['item_id'].'|'.$row['supplier_id'].'|'.$row_num; 
    array_push($data, $name); 
    } 
    echo json_encode($data); 
} 
+0

を使用してみてください。 –

+0

yes dbからデータを取得するために使用するクエリは – user3839366

答えて

0

なぜあなたは同じクエリで `like`と` against`の両方を使用していますか?クエリ

の下
public function product_autocomplete() 
    { 
     $name_startsWith = $_POST['name_startsWith']; 
     $type = $_POST['type']; 
     $row_num = $_POST['row_num']; 
     $query = $this->db->select('item_id,item_number,name,tax_included,cost_price,categoryid,unit_price,supplier_id,quantity_received') 
     ->from('bgs_items') 
     ->where('MATCH (bgs_items.item_number) AGAINST ("'. $name_startsWith .'")', NULL, false) 
     ->limit(10) 
     ->get(); 
     $data = array(); 

     foreach ($query->result_array() as $row) 
     { 
     $name = $row['item_number']."-".$row['name'].'|'.$row['name'].'|'.$row['tax_included'].'|'.$row['cost_price'].'|'.$row['categoryid'].'|'.$row['unit_price'].'|'.$row['supplier_id'].'|'.$row['quantity_received'].'|'.$row['item_number'].'|'.$row['item_id'].'|'.$row['supplier_id'].'|'.$row_num; 
     array_push($data, $name); 
     } 
     echo json_encode($data); 
    } 
+0

です。 – user3839366

関連する問題