I have a secondary table that has various keywords associated with product_ids
When searching directly in the database, searching all 180000 entries for a keyword takes 0.0004 seconds
Searching through the store takes about 5 seconds
Am I missing something about the way that search works in the store?
Could I search this table more efficiently?
Code:
$from_str = "FROM (" . TABLE_PRODUCTS . " p
LEFT JOIN " . TABLE_MANUFACTURERS . " m
USING(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c )
LEFT JOIN " . TABLE_PRODUCTS_KEYWORDS . " pk on p.products_id = pk.products_id and p.products_id = pk.products_id";
Code:
$where_str .= " OR (pk.keyword
= ':keywords'
AND p.products_id = pk.products_id)";
$where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');
Bookmarks