Skip to content

Instantly share code, notes, and snippets.

@v-r
Created June 6, 2019 15:08
Show Gist options
  • Save v-r/5c12b209a26d03570b0fb765860f5d8f to your computer and use it in GitHub Desktop.
Save v-r/5c12b209a26d03570b0fb765860f5d8f to your computer and use it in GitHub Desktop.
INSERT INTO `search_tmp_5cd1b4ae222eb9_22190229` SELECT `main_select`.`entity_id`, SUM(score) AS `relevance` FROM (SELECT DISTINCT `search_index`.`entity_id`, (((0) + (0) + (0) + (0) + (0) + (0)) * 1) AS `score` FROM `catalog_product_index_eav` AS `search_index` INNER JOIN `catalog_product_index_eav` AS `try_clothing_size_filter_filter` ON `search_index`.`entity_id` = `try_clothing_size_filter_filter`.`entity_id` AND `try_clothing_size_filter_filter`.`attribute_id` = 239 AND `try_clothing_size_filter_filter`.`store_id` = 3 INNER JOIN `catalog_product_index_eav` AS `try_shoes_size_filter_filter` ON `search_index`.`entity_id` = `try_shoes_size_filter_filter`.`entity_id` AND `try_shoes_size_filter_filter`.`attribute_id` = 267 AND `try_shoes_size_filter_filter`.`store_id` = 3 INNER JOIN `catalog_product_index_eav` AS `try_subcategory_filter` ON `search_index`.`entity_id` = `try_subcategory_filter`.`entity_id` AND `try_subcategory_filter`.`attribute_id` = 195 AND `try_subcategory_filter`.`store_id` = 3 INNER JOIN `catalog_product_index_eav` AS `try_taxon2_filter` ON `search_index`.`entity_id` = `try_taxon2_filter`.`entity_id` AND `try_taxon2_filter`.`attribute_id` = 197 AND `try_taxon2_filter`.`store_id` = 3 INNER JOIN `cataloginventory_stock_status` AS `stock_index` ON stock_index.product_id = search_index.entity_id AND `stock_index`.`website_id` = 0 AND `stock_index`.`stock_status` = 1 AND `stock_index`.`stock_id` = 1 INNER JOIN `cataloginventory_stock_status` AS `sub_products_stock_index` ON sub_products_stock_index.product_id = search_index.source_id AND `sub_products_stock_index`.`website_id` = 0 AND `sub_products_stock_index`.`stock_status` = 1 AND `sub_products_stock_index`.`stock_id` = 1 INNER JOIN `catalog_product_index_eav` AS `visibility_filter` ON search_index.entity_id = visibility_filter.entity_id AND `visibility_filter`.`attribute_id` = 99 AND `visibility_filter`.`value` in ('2', '4') AND `visibility_filter`.`store_id` = '3' INNER JOIN `catalog_category_product_index_store3` AS `category_ids_index` ON search_index.entity_id = category_ids_index.product_id AND category_ids_index.store_id = '3' WHERE (search_index.store_id = '3') AND (category_ids_index.category_id = 3282) AND (try_clothing_size_filter_filter.value IN ('3496')) AND (try_shoes_size_filter_filter.value IN ('3919','3914')) AND (try_subcategory_filter.value IN ('20')) AND (try_taxon2_filter.value IN ('58'))) AS `main_select` GROUP BY `entity_id` ORDER BY `relevance` DESC, `entity_id` DESC LIMIT 10000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment