Beispiel #1
0
 /**
  * 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;
 }
Beispiel #2
0
 /**
  * @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();
 }
Beispiel #3
0
 /**
  * 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();
     }
 }