/** * Drops and recreates the index. So one can start indexing. * * @return boolean */ public function startIndex() { if ($this->storage->isExists()) { $this->storage->drop(); } if ($this->dictionary->isExists()) { $this->dictionary->drop(); } $this->dictionary->create(); $this->storage->create(); return true; }
/** * @param integer $iblockId Information block identifier. */ public function __construct($iblockId) { $this->iblockId = intval($iblockId); $this->valid = \CIBlock::getArrayByID($this->iblockId, "PROPERTY_INDEX") === "Y"; if (self::$catalog === null) { self::$catalog = \Bitrix\Main\Loader::includeModule("catalog"); } if (self::$catalog) { $catalogInfo = \CCatalogSKU::getInfoByProductIBlock($this->iblockId); if (!empty($catalogInfo) && is_array($catalogInfo)) { $this->skuIblockId = $catalogInfo["IBLOCK_ID"]; $this->skuPropertyId = $catalogInfo["SKU_PROPERTY_ID"]; $this->valid = $this->valid && \CIBlock::getArrayByID($this->skuIblockId, "PROPERTY_INDEX") === "Y"; } } $this->dictionary = new Dictionary($this->iblockId); $this->storage = new Storage($this->iblockId); $this->valid = $this->valid && $this->dictionary->isExists(); }
/** * Drops all related to index database structures. * * @param integer $iblockId Information block identifier. * * @return void * @throws \Bitrix\Main\Db\SqlQueryException */ public static function dropIfExists($iblockId) { $storage = new Storage($iblockId); if ($storage->isExists()) { $storage->drop(); } $dictionary = new Dictionary($iblockId); if ($dictionary->isExists()) { $dictionary->drop(); } }