public function InitializeIndexer()
    {
        $bWorkToDo = true;
        if (!$this->bRegenerateCompleteIndex) {
            // drop index
            $query = "UPDATE shop_search_reindex_queue SET `processing` = '1'";
            MySqlLegacySupport::getInstance()->query($query);
            $query = "SELECT COUNT(*) AS reccount FROM shop_search_reindex_queue WHERE `processing` = '1'";
            $aCount = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query));
            if ($aCount['reccount'] > 0) {
                $query = "SHOW TABLES LIKE '_index_%'";
                $tRes = MySqlLegacySupport::getInstance()->query($query);
                while ($aIndexTable = MySqlLegacySupport::getInstance()->fetch_row($tRes)) {
                    $query = "DELETE FROM {$aIndexTable[0]} USING {$aIndexTable[0]}, shop_search_reindex_queue WHERE {$aIndexTable[0]}.`shop_article_id`= shop_search_reindex_queue.object_id AND `shop_search_reindex_queue`.`processing`='1' ";
                    MySqlLegacySupport::getInstance()->query($query);
                }
                $sQuery = "DELETE FROM shop_search_reindex_queue WHERE `processing` = '1' AND `action` = 'delete'";
                MySqlLegacySupport::getInstance()->query($sQuery);

                $query = "SELECT COUNT(*) AS reccount FROM shop_search_reindex_queue WHERE `processing` = '1'";
                $aCount = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query));
                if (0 == $aCount['reccount']) {
                    $bWorkToDo = false;
                }
            } else {
                $bWorkToDo = false;
            }
        }
        if ($bWorkToDo) {
            $this->aTablesToProcess = array();
            $aData = $this->sqlData;
            $aData['started'] = date('Y-m-d H:i:s');
            $aData['completed'] = date('0000-00-00 00:00:00');
            $iTotalRows = 0;
            $query = 'SELECT shop_search_query.*
                    FROM shop_search_query
              INNER JOIN shop_search_field_weight ON shop_search_query.id = shop_search_field_weight.shop_search_query_id
                GROUP BY shop_search_query.id
                 ';
            $oIndexQueries = &TdbShopSearchQueryList::GetList($query);
            while ($oIndexQuery = &$oIndexQueries->Next()) {
                $oIndexQuery->StartIndex($this->bRegenerateCompleteIndex);
                $iNumberOfItems = $oIndexQuery->NumberOfRecordsLeftToIndex();
                if ($iNumberOfItems > 0) {
                    $iTotalRows += $iNumberOfItems;
                    $this->aTablesToProcess[] = $oIndexQuery->id;
                }
            }
            $aData['total_rows_to_process'] = $iTotalRows;
            $sTmp = serialize($this->aTablesToProcess);
            $aData['processdata'] = $sTmp;

            $this->LoadFromRow($aData);
            $this->AllowEditByAll(true);
            $this->Save();

            $this->CommitProcessData();

            $this->CreateIndexTables();
        }
    }