101 if ($this->storage->isExists())
102 $this->storage->drop();
103 if ($this->dictionary->isExists())
104 $this->dictionary->drop();
106 $this->dictionary->create();
107 $this->storage->create();
119 \Bitrix\Iblock\IblockTable::update($this->iblockId, array(
120 "PROPERTY_INDEX" =>
"Y",
123 \CIBlock::CleanCache($this->iblockId);
124 if ($this->skuIblockId)
126 \Bitrix\Iblock\IblockTable::update($this->skuIblockId, array(
127 "PROPERTY_INDEX" =>
"Y",
130 \CIBlock::CleanCache($this->skuIblockId);
193 $element =
new Element($this->iblockId, $elementId);
194 $element->loadFromDatabase();
196 $elementSections = $element->getSections();
199 foreach ($element->getParentSections() as $sectionId)
201 foreach ($elementIndexValues as $facetId => $values)
203 foreach ($values as $value)
205 $this->storage->queueIndexEntry(
211 in_array($sectionId, $elementSections)
217 foreach ($elementIndexValues as $facetId => $values)
219 foreach ($values as $value)
221 $this->storage->queueIndexEntry(
227 empty($elementSections)
232 $this->storage->flushIndexEntries();
287 array(
"VALUE" => 0,
"VALUE_NUM" => 0.0)
293 $facetId = $this->storage->propertyIdToFacetId($propertyId);
294 $result[$facetId] = array();
296 foreach ($propertyValues as $value)
298 $value = intval($value);
299 $result[$facetId][$value] = array(
308 $facetId = $this->storage->propertyIdToFacetId($propertyId);
309 $result[$facetId] = array();
311 foreach ($propertyValues as $value)
313 $valueId = $this->dictionary->getStringId($value);
314 $result[$facetId][$valueId] = array(
323 $facetId = $this->storage->propertyIdToFacetId($propertyId);
324 $result[$facetId] = array();
326 foreach ($propertyValues as $value)
328 $value = doubleval($value);
329 $result[$facetId][md5($value)] = array(
331 "VALUE_NUM" => $value,
338 $facetId = $this->storage->propertyIdToFacetId($propertyId);
339 $result[$facetId] = array();
341 foreach ($propertyValues as $value)
344 $timestamp = MakeTimeStamp($value,
"YYYY-MM-DD HH:MI:SS");
345 $value = date(
'Y-m-d', $timestamp);
346 $timestamp = MakeTimeStamp($value,
"YYYY-MM-DD");
347 $valueId = $this->dictionary->getStringId($value);
348 $result[$facetId][$valueId] = array(
350 "VALUE_NUM" => $timestamp,
357 $facetId = $this->storage->priceIdToFacetId($priceId);
358 $result[$facetId] = array();
362 foreach ($elementPrices as $currency => $priceValues)
364 $currencyId = $this->dictionary->getStringId($currency);
365 foreach ($priceValues as $price)
367 $result[$facetId][$currencyId.
":".$price] = array(
368 "VALUE" => $currencyId,
369 "VALUE_NUM" => $price,
376 return array_filter($result,
"count");
391 if (!isset($this->propertyFilter))
393 $this->propertyFilter = array(
399 $propertyList = \Bitrix\Iblock\SectionPropertyTable::getList(array(
400 "select" => array(
"PROPERTY_ID",
"PROPERTY.PROPERTY_TYPE",
"PROPERTY.USER_TYPE"),
402 "=IBLOCK_ID" => array($this->iblockId, $this->skuIblockId),
403 "=SMART_FILTER" =>
"Y",
406 while ($link = $propertyList->fetch())
409 "PROPERTY_TYPE" => $link[
"IBLOCK_SECTION_PROPERTY_PROPERTY_PROPERTY_TYPE"],
410 "USER_TYPE" => $link[
"IBLOCK_SECTION_PROPERTY_PROPERTY_USER_TYPE"],
412 $this->propertyFilter[$storageType][] = $link[
"PROPERTY_ID"];
415 return $this->propertyFilter[$propertyType];