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