New Patch:
typo3/sysext/indexed_search/ext_localconf.php
added Line (on Line 20):
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['tx_indexedsearch'] = 'EXT:indexed_search/class.crawler.php:&tx_indexedsearch_crawler';
typo3/sysext/indexed_search/class.crawler.php
2 Added Methods:
deleteHashsForThisPage
processCmdmap_preProcess (Hook)
1 Changed Method (Hook):
processDatamap_afterDatabaseOperations
On line 809:
/**
* Deletes all data recorded by indexed search for a given page
*
* @param integer Uid of the page to delete all pHash (=indices)
* @return void
* @author Michael Fritz / TARGET-E
*/
function deleteHashsForThisPage ($id) {
$pHashesToDelete_res = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('phash','index_section', 'page_id='.intval($id));
$pHashesToDelete = array();
for ($i=0; $i<count($pHashesToDelete_res); $i++) {
$pHashesToDelete[] = $pHashesToDelete_res[$i]['phash'];
}
$GLOBALS['TYPO3_DB']->exec_DELETEquery('index_section', 'phash IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)).')');
$GLOBALS['TYPO3_DB']->exec_DELETEquery('index_rel', 'phash IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)).')');
$GLOBALS['TYPO3_DB']->exec_DELETEquery('index_phash', 'phash IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)).')');
$GLOBALS['TYPO3_DB']->exec_DELETEquery('index_grlist', 'phash IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)).')');
$GLOBALS['TYPO3_DB']->exec_DELETEquery('index_fulltext', 'phash IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)).')');
$GLOBALS['TYPO3_DB']->exec_DELETEquery('index_debug', 'phash IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)).')');
}
/*************************
*
* Hooks functions for TCEmain (indexing of records)
******************/
/**
* TCEmain hook function for on-the-fly indexing of database records
*
* @param string command "new" or "update"
* @param string Table name
* @param string Record ID. If new record its a string pointing to index inside t3lib_tcemain::substNEWwithIDs
* @param unknown Unknown
* @param object Reference to tcemain calling object
* @return void
* @author Michael Fritz / TARGET-E
*/
function processCmdmap_preProcess($command, $table, $id, $value, $TCEMAIN_this) {
if ($command=='delete' && $table 'pages') {
$this->deleteHashsForThisPage($id);
}
}
/**
* TCEmain hook function for on-the-fly indexing of database records
*
* @param string Status "new" or "update"
* @param string Table name
* @param string Record ID. If new record its a string pointing to index inside t3lib_tcemain::substNEWwithIDs
* @param array Field array of updated fields in the operation
* @param object Reference to tcemain calling object
* @return void
*/
function processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, &$pObj) {
// Check if any fields are actually updated:
if (count($fieldArray)) {
// Translate new ids.
if ($status'new') {
$id = $pObj->substNEWwithIDs[$id];
}
//PATCH PATCH PATCH PATCH PATCH PATCH
//if the page should be hidden or not indexed after update, delete index for this page
else if ($table 'pages' && $status'update' && (array_key_exists('hidden',$fieldArray) && $fieldArray['hidden']==1) || (array_key_exists('no_search',$fieldArray) && $fieldArray['no_search']==1)) {
$this->deleteHashsForThisPage($id);
}
//PATCH PATCH PATCH PATCH PATCH PATCH
// Get full record and if exists, search for indexing configurations:
$currentRecord = t3lib_BEfunc::getRecord($table,$id);
if (is_array($currentRecord)) {
// Select all (not running) indexing configurations of type "record" (1) and which points to this table and is located on the same page as the record or pointing to the right source PID
$indexingConfigurations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'*',
'index_config',
'hidden=0
AND (starttime=0 OR starttime<='.time().')
AND set_id=0
AND type=1
AND table2index='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'index_config').'
AND (
(alternative_source_pid='.$GLOBALS['TYPO3_DB']->fullQuoteStr('','index_config').' AND pid='.intval($currentRecord['pid']).')
OR (alternative_source_pid='.$GLOBALS['TYPO3_DB']->fullQuoteStr($currentRecord['pid'],'index_config').')
)
AND records_indexonchange=1
'.t3lib_BEfunc::deleteClause('index_config')
);
foreach($indexingConfigurations as $cfgRec) {
$this->indexSingleRecord($currentRecord,$cfgRec);
}
}
}
}