Version Notes
This version is compatible with Magento 1.4.
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Sonassi_FastSearchIndex |
| Version | 1.2.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.6 to 1.2.0
app/code/community/Sonassi/FastSearchIndex/Block/Index/Adminhtml/Process.php
CHANGED
|
@@ -1,47 +1,60 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Magento
|
| 4 |
-
*
|
| 5 |
-
* NOTICE OF LICENSE
|
| 6 |
-
*
|
| 7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
-
* It is also available through the world-wide-web at this URL:
|
| 10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
-
* If you did not receive a copy of the license and are unable to
|
| 12 |
-
* obtain it through the world-wide-web, please send an email
|
| 13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
-
*
|
| 15 |
-
* DISCLAIMER
|
| 16 |
-
*
|
| 17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
-
* versions in the future. If you wish to customize Magento for your
|
| 19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
-
*
|
| 21 |
-
* @category Mage
|
| 22 |
-
* @package Mage_Index
|
| 23 |
-
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
-
*/
|
| 26 |
-
|
| 27 |
-
class Sonassi_FastSearchIndex_Block_Index_Adminhtml_Process extends Mage_Index_Block_Adminhtml_Process
|
| 28 |
-
{
|
| 29 |
-
public function __construct()
|
| 30 |
-
{
|
| 31 |
-
$this->_blockGroup = 'index';
|
| 32 |
-
$this->_controller = 'adminhtml_process';
|
| 33 |
-
$this->_headerText = Mage::helper('index')->__('Index Management');
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
'
|
| 37 |
-
'
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Index
|
| 23 |
+
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
class Sonassi_FastSearchIndex_Block_Index_Adminhtml_Process extends Mage_Index_Block_Adminhtml_Process
|
| 28 |
+
{
|
| 29 |
+
public function __construct()
|
| 30 |
+
{
|
| 31 |
+
$this->_blockGroup = 'index';
|
| 32 |
+
$this->_controller = 'adminhtml_process';
|
| 33 |
+
$this->_headerText = Mage::helper('index')->__('Index Management');
|
| 34 |
+
|
| 35 |
+
$this->_addButton('refresh_catprod', array(
|
| 36 |
+
'label' => Mage::helper('index')->__('Sonassi Category Products'),
|
| 37 |
+
'onclick' => 'setLocation(\'' . $this->getRefreshCatProdUrl() . '\')',
|
| 38 |
+
'class' => 'save'
|
| 39 |
+
), 10);
|
| 40 |
+
|
| 41 |
+
$this->_addButton('refresh_search', array(
|
| 42 |
+
'label' => Mage::helper('index')->__('Sonassi Catalog Search Index'),
|
| 43 |
+
'onclick' => 'setLocation(\'' . $this->getRefreshUrl() . '\')',
|
| 44 |
+
'class' => 'save'
|
| 45 |
+
), 10);
|
| 46 |
+
|
| 47 |
+
Mage_Adminhtml_Block_Widget_Grid_Container::__construct();
|
| 48 |
+
$this->_removeButton('add');
|
| 49 |
+
}
|
| 50 |
+
public function getRefreshUrl() {
|
| 51 |
+
|
| 52 |
+
return $this->getUrl('fastsearchindex/admin/refreshSearch');
|
| 53 |
+
|
| 54 |
+
}
|
| 55 |
+
public function getRefreshCatProdUrl() {
|
| 56 |
+
|
| 57 |
+
return $this->getUrl('fastsearchindex/admin/refreshCatProd');
|
| 58 |
+
|
| 59 |
+
}
|
| 60 |
+
}
|
app/code/community/Sonassi/FastSearchIndex/controllers/AdminController.php
CHANGED
|
@@ -1,40 +1,68 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Sonassi_FastSearchIndex_AdminController extends Mage_Adminhtml_Controller_Action
|
| 4 |
-
{
|
| 5 |
-
|
| 6 |
-
public function refreshSearchAction()
|
| 7 |
-
{
|
| 8 |
-
// fetch write database connection that is used in Mage_Core module
|
| 9 |
-
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 10 |
-
|
| 11 |
-
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 12 |
-
$write->query("UPDATE `index_process` SET status = 'working', started_at = NOW() WHERE indexer_code = 'catalogsearch_fulltext'");
|
| 13 |
-
|
| 14 |
-
$allStores = Mage::app()->getStores();
|
| 15 |
-
|
| 16 |
-
$nameAttributeId = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product','name')->getAttributeId();
|
| 17 |
-
$descAttributeId = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product','description')->getAttributeId();
|
| 18 |
-
|
| 19 |
-
$query = "TRUNCATE `catalogsearch_fulltext`;";
|
| 20 |
-
foreach ($allStores as $_eachStoreId => $val) {
|
| 21 |
-
$query .= "INSERT IGNORE INTO catalogsearch_fulltext (product_id, store_id, data_index)
|
| 22 |
-
SELECT DISTINCT ca_ent.entity_id as product_id, ".$_eachStoreId." as store_id,
|
| 23 |
-
CONCAT(ifnull(ca_var.value,''),' ',ifnull(ca_ent.sku,''), ' ',
|
| 24 |
-
ifnull((SELECT GROUP_CONCAT( ca_ent2.sku) FROM `catalog_product_entity` ca_ent2 LEFT JOIN `catalog_product_super_link` ca_sup ON ca_sup.product_id = ca_ent2.entity_id WHERE ca_sup.parent_id = ca_ent.entity_id GROUP BY ca_sup.parent_id),'') ,' ',
|
| 25 |
-
ifnull((SELECT GROUP_CONCAT( ca_ent3.sku) FROM `catalog_product_entity` ca_ent3 LEFT JOIN `catalog_product_link` ca_lin ON ca_lin.linked_product_id = ca_ent3.entity_id WHERE ca_lin.product_id = ca_ent.entity_id GROUP BY ca_lin.product_id),'') ,' ',
|
| 26 |
-
ifnull(ca_text.value,'')) as data_index
|
| 27 |
-
FROM `catalog_product_entity` ca_ent LEFT JOIN `catalog_product_entity_varchar` ca_var ON ca_var.entity_id = ca_ent.entity_id AND ca_var.attribute_id = ".$nameAttributeId."
|
| 28 |
-
LEFT JOIN `catalog_product_entity_text` ca_text ON ca_text.entity_id = ca_ent.entity_id AND ca_text.attribute_id = ".$descAttributeId."
|
| 29 |
-
;";
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 33 |
-
$write->query($query);
|
| 34 |
-
|
| 35 |
-
$write->query("UPDATE `index_process` SET status = 'pending', ended_at = NOW() WHERE indexer_code = 'catalogsearch_fulltext'");
|
| 36 |
-
|
| 37 |
-
Mage::getSingleton('core/session')->addSuccess(Mage::helper('index')->__('%s index was rebuilt.', 'Catalog Search Index'));
|
| 38 |
-
$this->_redirect('adminhtml/process/list/');
|
| 39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
}
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Sonassi_FastSearchIndex_AdminController extends Mage_Adminhtml_Controller_Action
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
public function refreshSearchAction()
|
| 7 |
+
{
|
| 8 |
+
// fetch write database connection that is used in Mage_Core module
|
| 9 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 10 |
+
|
| 11 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 12 |
+
$write->query("UPDATE `index_process` SET status = 'working', started_at = NOW() WHERE indexer_code = 'catalogsearch_fulltext'");
|
| 13 |
+
|
| 14 |
+
$allStores = Mage::app()->getStores();
|
| 15 |
+
|
| 16 |
+
$nameAttributeId = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product','name')->getAttributeId();
|
| 17 |
+
$descAttributeId = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product','description')->getAttributeId();
|
| 18 |
+
|
| 19 |
+
$query = "TRUNCATE `catalogsearch_fulltext`;";
|
| 20 |
+
foreach ($allStores as $_eachStoreId => $val) {
|
| 21 |
+
$query .= "INSERT IGNORE INTO catalogsearch_fulltext (product_id, store_id, data_index)
|
| 22 |
+
SELECT DISTINCT ca_ent.entity_id as product_id, ".$_eachStoreId." as store_id,
|
| 23 |
+
CONCAT(ifnull(ca_var.value,''),' ',ifnull(ca_ent.sku,''), ' ',
|
| 24 |
+
ifnull((SELECT GROUP_CONCAT( ca_ent2.sku) FROM `catalog_product_entity` ca_ent2 LEFT JOIN `catalog_product_super_link` ca_sup ON ca_sup.product_id = ca_ent2.entity_id WHERE ca_sup.parent_id = ca_ent.entity_id GROUP BY ca_sup.parent_id),'') ,' ',
|
| 25 |
+
ifnull((SELECT GROUP_CONCAT( ca_ent3.sku) FROM `catalog_product_entity` ca_ent3 LEFT JOIN `catalog_product_link` ca_lin ON ca_lin.linked_product_id = ca_ent3.entity_id WHERE ca_lin.product_id = ca_ent.entity_id GROUP BY ca_lin.product_id),'') ,' ',
|
| 26 |
+
ifnull(ca_text.value,'')) as data_index
|
| 27 |
+
FROM `catalog_product_entity` ca_ent LEFT JOIN `catalog_product_entity_varchar` ca_var ON ca_var.entity_id = ca_ent.entity_id AND ca_var.attribute_id = ".$nameAttributeId."
|
| 28 |
+
LEFT JOIN `catalog_product_entity_text` ca_text ON ca_text.entity_id = ca_ent.entity_id AND ca_text.attribute_id = ".$descAttributeId."
|
| 29 |
+
;";
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 33 |
+
$write->query($query);
|
| 34 |
+
|
| 35 |
+
$write->query("UPDATE `index_process` SET status = 'pending', ended_at = NOW() WHERE indexer_code = 'catalogsearch_fulltext'");
|
| 36 |
+
|
| 37 |
+
Mage::getSingleton('core/session')->addSuccess(Mage::helper('index')->__('%s index was rebuilt.', 'Catalog Search Index'));
|
| 38 |
+
$this->_redirect('adminhtml/process/list/');
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
public function refreshCatProdAction()
|
| 42 |
+
{
|
| 43 |
+
// fetch write database connection that is used in Mage_Core module
|
| 44 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 45 |
+
|
| 46 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 47 |
+
$res = $write->query("SHOW INDEX FROM catalog_category_product_index_idx WHERE key_name = 'catalog_cat_product_idx'");
|
| 48 |
+
$isNo = $res->fetchAll();
|
| 49 |
+
|
| 50 |
+
if(count($isNo))
|
| 51 |
+
$write->query("DROP INDEX catalog_cat_product_idx ON catalog_category_product_index_idx;");
|
| 52 |
+
|
| 53 |
+
$write->query("CREATE TABLE `new_catalog_category_product_index_idx` LIKE `catalog_category_product_index_idx`;
|
| 54 |
+
RENAME TABLE `catalog_category_product_index_idx` TO `old_catalog_category_product_index_idx`, `new_catalog_category_product_index_idx` TO `catalog_category_product_index_idx`;
|
| 55 |
+
DROP TABLE `old_catalog_category_product_index_idx`;");
|
| 56 |
+
|
| 57 |
+
$write->query("CREATE INDEX catalog_cat_product_idx ON catalog_category_product_index_idx(product_id,category_id,store_id); ");
|
| 58 |
+
|
| 59 |
+
$indexProcess = Mage::getSingleton('index/indexer')->getProcessByCode('catalog_category_product');
|
| 60 |
+
if ($indexProcess) {
|
| 61 |
+
$indexProcess->reindexAll();
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
Mage::getSingleton('core/session')->addSuccess(Mage::helper('index')->__('%s index was rebuilt.', 'Category Products Index'));
|
| 65 |
+
$this->_redirect('adminhtml/process/list/');
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
}
|
app/code/community/Sonassi/FastSearchIndex/etc/config.xml
CHANGED
|
@@ -1,34 +1,34 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<config>
|
| 3 |
-
<modules>
|
| 4 |
-
<Sonassi_FastSearchIndex>
|
| 5 |
-
<version>1.0
|
| 6 |
-
<depends>
|
| 7 |
-
<!-- no dependencies -->
|
| 8 |
-
</depends>
|
| 9 |
-
</Sonassi_FastSearchIndex>
|
| 10 |
-
</modules>
|
| 11 |
-
<global>
|
| 12 |
-
<models />
|
| 13 |
-
<resources />
|
| 14 |
-
<extraconfig />
|
| 15 |
-
<blocks>
|
| 16 |
-
<index>
|
| 17 |
-
<rewrite>
|
| 18 |
-
<adminhtml_process>Sonassi_FastSearchIndex_Block_Index_Adminhtml_Process</adminhtml_process>
|
| 19 |
-
</rewrite>
|
| 20 |
-
</index>
|
| 21 |
-
</blocks>
|
| 22 |
-
</global>
|
| 23 |
-
<admin>
|
| 24 |
-
<routers>
|
| 25 |
-
<fastsearchindex>
|
| 26 |
-
<use>admin</use>
|
| 27 |
-
<args>
|
| 28 |
-
<module>Sonassi_FastSearchIndex</module>
|
| 29 |
-
<frontName>fastsearchindex</frontName>
|
| 30 |
-
</args>
|
| 31 |
-
</fastsearchindex>
|
| 32 |
-
</routers>
|
| 33 |
-
</admin>
|
| 34 |
</config>
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Sonassi_FastSearchIndex>
|
| 5 |
+
<version>1.2.0</version>
|
| 6 |
+
<depends>
|
| 7 |
+
<!-- no dependencies -->
|
| 8 |
+
</depends>
|
| 9 |
+
</Sonassi_FastSearchIndex>
|
| 10 |
+
</modules>
|
| 11 |
+
<global>
|
| 12 |
+
<models />
|
| 13 |
+
<resources />
|
| 14 |
+
<extraconfig />
|
| 15 |
+
<blocks>
|
| 16 |
+
<index>
|
| 17 |
+
<rewrite>
|
| 18 |
+
<adminhtml_process>Sonassi_FastSearchIndex_Block_Index_Adminhtml_Process</adminhtml_process>
|
| 19 |
+
</rewrite>
|
| 20 |
+
</index>
|
| 21 |
+
</blocks>
|
| 22 |
+
</global>
|
| 23 |
+
<admin>
|
| 24 |
+
<routers>
|
| 25 |
+
<fastsearchindex>
|
| 26 |
+
<use>admin</use>
|
| 27 |
+
<args>
|
| 28 |
+
<module>Sonassi_FastSearchIndex</module>
|
| 29 |
+
<frontName>fastsearchindex</frontName>
|
| 30 |
+
</args>
|
| 31 |
+
</fastsearchindex>
|
| 32 |
+
</routers>
|
| 33 |
+
</admin>
|
| 34 |
</config>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Sonassi_FastSearchIndex</name>
|
| 4 |
-
<version>1.0
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>Under licence from Sonassi.com</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -9,10 +9,10 @@
|
|
| 9 |
<summary>Sonassi Fast Search Index extension</summary>
|
| 10 |
<description>The Sonassi Fast Search Index extension allows you to quickly refresh your catalogfullsearch index if you have a big catalog.</description>
|
| 11 |
<notes>This version is compatible with Magento 1.4.</notes>
|
| 12 |
-
<authors><author><name>Ben Lessani</name><user>auto-converted</user><email>contact@sonassi.com</email></author></authors>
|
| 13 |
-
<date>2011-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Sonassi_FastSearchIndex.xml" hash="e6d150b19bc71606818ebe9fca9549ac"/></dir></target><target name="magecommunity"><dir name="Sonassi"><dir name="FastSearchIndex"><dir name="Block"><dir name="Index"><dir name="Adminhtml"><file name="Process.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies/>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Sonassi_FastSearchIndex</name>
|
| 4 |
+
<version>1.2.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>Under licence from Sonassi.com</license>
|
| 7 |
<channel>community</channel>
|
| 9 |
<summary>Sonassi Fast Search Index extension</summary>
|
| 10 |
<description>The Sonassi Fast Search Index extension allows you to quickly refresh your catalogfullsearch index if you have a big catalog.</description>
|
| 11 |
<notes>This version is compatible with Magento 1.4.</notes>
|
| 12 |
+
<authors><author><name>Ben Lessani</name><user>auto-converted</user><email>contact@sonassi.com</email></author><author><name>François Letocart</name><user>auto-converted</user><email>contact@sonassi.com</email></author></authors>
|
| 13 |
+
<date>2011-02-14</date>
|
| 14 |
+
<time>16:13:04</time>
|
| 15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Sonassi_FastSearchIndex.xml" hash="e6d150b19bc71606818ebe9fca9549ac"/></dir></target><target name="magecommunity"><dir name="Sonassi"><dir name="FastSearchIndex"><dir name="Block"><dir name="Index"><dir name="Adminhtml"><file name="Process.php" hash="a789fd989b3e08bf73de08a325c4b0cd"/></dir></dir></dir><dir name="controllers"><file name="AdminController.php" hash="9dc85aee4a32a1859f355c30aaadf653"/></dir><dir name="etc"><file name="config.xml" hash="2fe6a9e95867718f886c5c2ea3c1df97"/></dir></dir></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies/>
|
| 18 |
</package>
|
