/** * Changes index after rename. * @param File $file Target file. * @throws \Bitrix\Main\LoaderException * @return void */ public function changeName(File $file) { if (!Loader::includeModule('search')) { return; } //here we place configuration by Module (Options). Example, we can deactivate index for big files in Disk. if (!Configuration::allowIndexFiles()) { return; } $detailUrl = Driver::getInstance()->getUrlManager()->getPathFileDetail($file); /** @noinspection PhpDynamicAsStaticMethodCallInspection */ CSearch::changeIndex(Driver::INTERNAL_MODULE_ID, array('TITLE' => $file->getName(), 'URL' => $detailUrl), $this->getItemId($file)); }
/** * Changes index after rename. * @param BaseObject $object Target file or folder. * @throws \Bitrix\Main\LoaderException * @return void */ public function changeName(BaseObject $object) { if (!Loader::includeModule('search')) { return; } //here we place configuration by Module (Options). Example, we can deactivate index for big files in Disk. if (!Configuration::allowIndexFiles()) { return; } $storage = $object->getStorage(); if (!$storage) { return; } if (!$storage->getProxyType()->canIndexBySearch()) { return; } if ($object instanceof Folder) { $this->indexFolder($object); } elseif ($object instanceof File) { $this->indexFile($object); } }