/** * Indexes one element. * * @param integer $elementId Element identifier. * * @return void */ public function indexElement($elementId) { $indexEntries = array(); $element = new Element($this->iblockId, $elementId); $element->loadFromDatabase(); $elementSections = $element->getSections(); foreach ($element->getParentSections() as $sectionId) { $indexEntries[$sectionId] = $this->getSectionIndexEntries($element, $sectionId); } $c = 0; $indexEntries = array_filter($indexEntries, "count"); foreach ($indexEntries as $sectionId => $sectionEntry) { foreach ($sectionEntry as $facetId => $values) { foreach ($values as $value) { $this->storage->addIndexEntry($sectionId, $elementId, $facetId, $value["VALUE"], $value["VALUE_NUM"], in_array($sectionId, $elementSections)); $c++; } } } if ($c == 0) { $this->storage->addIndexEntry(0, $elementId, 0, 0, 0.0, true); } }