0
上午在使用CodeIgniter進行全文搜索時遇到了問題。在這裏,我有一個動態行和列的表,當我使用全文索引搜索輸入字段到一行時,速度非常緩慢。這裏已經將以下值設置爲DB引擎作爲MYISAM,將表列設置爲FULLTEXT INDEX。我希望輸入字段中的數據非常快。這裏有我附加了我累了的事。請檢查它並讓我知道。使用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);
}
? –
是什麼查詢我想用於從數據庫獲取數據 – user3839366