Version Notes
This version is compatible with Magento 1.3 and 1.4.
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Sonassi_FastSearchIndex |
| Version | 1.0.3 |
| Comparing to | |
| See all releases | |
Version 1.0.3
- app/code/community/Sonassi/FastSearchIndex/Block/Index/Adminhtml/Process.php +47 -0
- app/code/community/Sonassi/FastSearchIndex/controllers/AdminController.php +33 -0
- app/code/community/Sonassi/FastSearchIndex/controllers/IndexController.php +87 -0
- app/code/community/Sonassi/FastSearchIndex/etc/config.xml +34 -0
- app/etc/modules/Sonassi_FastSearchIndex.xml +8 -0
- package.xml +18 -0
app/code/community/Sonassi/FastSearchIndex/Block/Index/Adminhtml/Process.php
ADDED
|
@@ -0,0 +1,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 |
+
$this->_addButton('refresh_search', array(
|
| 35 |
+
'label' => Mage::helper('index')->__('Sonassi Catalog Search Index'),
|
| 36 |
+
'onclick' => 'setLocation(\'' . $this->getRefreshUrl() . '\')',
|
| 37 |
+
'class' => 'save'
|
| 38 |
+
), 10);
|
| 39 |
+
Mage_Adminhtml_Block_Widget_Grid_Container::__construct();
|
| 40 |
+
$this->_removeButton('add');
|
| 41 |
+
}
|
| 42 |
+
public function getRefreshUrl() {
|
| 43 |
+
|
| 44 |
+
return $this->getUrl('fastsearchindex/admin/refreshSearch');
|
| 45 |
+
|
| 46 |
+
}
|
| 47 |
+
}
|
app/code/community/Sonassi/FastSearchIndex/controllers/AdminController.php
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
$storeId = Mage::app()->getStore()->getId();
|
| 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 |
+
INSERT INTO catalogsearch_fulltext (product_id, store_id, data_index)
|
| 21 |
+
SELECT ca_ent.entity_id, ".$storeId.", CONCAT(ifnull(ca_var.value,''),' ',ifnull(ca_ent.sku,''), ' ',ifnull(ca_text.value,''))
|
| 22 |
+
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."
|
| 23 |
+
LEFT JOIN `catalog_product_entity_text` ca_text ON ca_text.entity_id = ca_ent.entity_id AND ca_text.attribute_id = ".$descAttributeId."";
|
| 24 |
+
|
| 25 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 26 |
+
$write->query($query);
|
| 27 |
+
|
| 28 |
+
$write->query("UPDATE `index_process` SET status = 'pending', ended_at = NOW() WHERE indexer_code = 'catalogsearch_fulltext'");
|
| 29 |
+
|
| 30 |
+
Mage::getSingleton('core/session')->addSuccess(Mage::helper('index')->__('%s index was rebuilt.', 'Catalog Search Index'));
|
| 31 |
+
$this->_redirect('adminhtml/process/list/');
|
| 32 |
+
}
|
| 33 |
+
}
|
app/code/community/Sonassi/FastSearchIndex/controllers/IndexController.php
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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_Customer
|
| 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 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Sonassi FastSearchIndex Controller
|
| 30 |
+
*
|
| 31 |
+
* @category FastSearchIndex
|
| 32 |
+
* @package Sonassi_FastSearchIndex
|
| 33 |
+
* @author Sonassi Team <contact@sonassi.com>
|
| 34 |
+
*/
|
| 35 |
+
class Sonassi_FastSearchIndex_IndexController extends Mage_Adminhtml_Controller_Action
|
| 36 |
+
{
|
| 37 |
+
protected function _initAction()
|
| 38 |
+
{
|
| 39 |
+
$this->loadLayout()
|
| 40 |
+
->_setActiveMenu('domains/manage')
|
| 41 |
+
->_addBreadcrumb(Mage::helper('domains')->__('Domains'), Mage::helper('domains')->__('Domains'));
|
| 42 |
+
return $this;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
public function indexAction()
|
| 46 |
+
{
|
| 47 |
+
exit('lol');
|
| 48 |
+
$this->_title($this->__('domains'))->_title($this->__('Manage Domains'));
|
| 49 |
+
|
| 50 |
+
$this->_initAction();
|
| 51 |
+
|
| 52 |
+
$this->_headerText = Mage::helper('domains')->__('Customers Reviews');
|
| 53 |
+
|
| 54 |
+
$this->renderLayout();
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
public function refreshSearchAction()
|
| 58 |
+
{
|
| 59 |
+
|
| 60 |
+
// fetch write database connection that is used in Mage_Core module
|
| 61 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 62 |
+
|
| 63 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 64 |
+
$write->query("UPDATE `index_process` SET status = 'working', started_at = NOW() WHERE indexer_code = 'catalogsearch_fulltext'");
|
| 65 |
+
|
| 66 |
+
$storeId = Mage::app()->getStore()->getId();
|
| 67 |
+
|
| 68 |
+
$nameAttributeId = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product','name')->getAttributeId();
|
| 69 |
+
$descAttributeId = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product','description')->getAttributeId();
|
| 70 |
+
|
| 71 |
+
$query = "TRUNCATE `catalogsearch_fulltext`;
|
| 72 |
+
INSERT INTO catalogsearch_fulltext (product_id, store_id, data_index)
|
| 73 |
+
SELECT ca_ent.entity_id, ".$storeId.", CONCAT(ifnull(ca_var.value,''),' ',ifnull(ca_ent.sku,''), ' ',ifnull(ca_text.value,''))
|
| 74 |
+
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."
|
| 75 |
+
LEFT JOIN `catalog_product_entity_text` ca_text ON ca_text.entity_id = ca_ent.entity_id AND ca_text.attribute_id = ".$descAttributeId."";
|
| 76 |
+
|
| 77 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
| 78 |
+
$write->query($query);
|
| 79 |
+
|
| 80 |
+
$write->query("UPDATE `index_process` SET status = 'pending', ended_at = NOW() WHERE indexer_code = 'catalogsearch_fulltext'");
|
| 81 |
+
|
| 82 |
+
Mage::getSingleton('core/session')->addSuccess(Mage::helper('index')->__('%s index was rebuilt.', 'Catalog Search Index'));
|
| 83 |
+
$this->_redirect('adminhtml/process/list/',array('key'=>$this->getRequest()->getParam('key')));
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
}
|
| 87 |
+
|
app/code/community/Sonassi/FastSearchIndex/etc/config.xml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Sonassi_FastSearchIndex>
|
| 5 |
+
<version>1.0.3</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>
|
app/etc/modules/Sonassi_FastSearchIndex.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<config>
|
| 2 |
+
<modules>
|
| 3 |
+
<Sonassi_FastSearchIndex>
|
| 4 |
+
<active>true</active>
|
| 5 |
+
<codePool>community</codePool>
|
| 6 |
+
</Sonassi_FastSearchIndex>
|
| 7 |
+
</modules>
|
| 8 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Sonassi_FastSearchIndex</name>
|
| 4 |
+
<version>1.0.3</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>Under licence from Sonassi.com</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 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.3 and 1.4.</notes>
|
| 12 |
+
<authors><author><name>Ben Lessani</name><user>auto-converted</user><email>contact@sonassi.com</email></author></authors>
|
| 13 |
+
<date>2011-01-12</date>
|
| 14 |
+
<time>10:52:16</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="d93d78e54c63f609ad35feb9acd410d2"/></dir></dir></dir><dir name="controllers"><file name="AdminController.php" hash="b52af461cc7bb486f9547a812cec496c"/><file name="IndexController.php" hash="0895725e3ecd91436f42fd5ac1b25510"/></dir><dir name="etc"><file name="config.xml" hash="0be6bae80f8a081ba6ee0f63fcbe9fc0"/></dir></dir></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies/>
|
| 18 |
+
</package>
|
