krot

opencart fulltext search

Nov 11th, 2017
96
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ALTER TABLE shoc_product
  2. ADD FULLTEXT INDEX `art`
  3. (`model` ASC);
  4.  
  5. SELECT p.product_id,p.model,
  6.  
  7. MATCH (p.`model`) AGAINST ('Подшипник полуоси 52701-4A000')p1,
  8. MATCH (pd.`name`) AGAINST ('Подшипник полуоси 52701-4A000')p2,
  9.  
  10. pd.`name`
  11.  FROM shoc_product p LEFT JOIN shoc_product_description pd ON (p.product_id = pd.product_id) LEFT JOIN shoc_product_to_store p2s ON (p.product_id = p2s.product_id)
  12.  
  13. WHERE
  14.  
  15. MATCH (p.`model`) AGAINST ('Подшипник полуоси 52701-4A000')
  16. or
  17. MATCH (pd.`name`) AGAINST ('Подшипник полуоси 52701-4A000')
  18. order by p1 DESC,p2 DESC
RAW Paste Data