| @@ 91-106 (lines=16) @@ | ||
| 88 | /** |
|
| 89 | * @return string |
|
| 90 | */ |
|
| 91 | private function reindex() |
|
| 92 | {
|
|
| 93 | $reindexProductIdList = $this->getReindexProductIdList($this->owner->id); |
|
| 94 | $removeParameterNameId = $this->owner->id; |
|
| 95 | Yii::app()->attachEventHandler('onEndRequest', function($event) use($reindexProductIdList, $removeParameterNameId) {
|
|
| 96 | ViewHelper::showFlash('Индексация фильтра началсь и может занять несколько минут');
|
|
| 97 | ||
| 98 | Utils::finishRequest(); |
|
| 99 | Utils::longLife(60); |
|
| 100 | ||
| 101 | $facetIndexer = new FacetIndexer(); |
|
| 102 | ||
| 103 | $facetIndexer->clearIndexByParameterNameIdList(array($removeParameterNameId)); |
|
| 104 | $facetIndexer->reindexProducts($reindexProductIdList); |
|
| 105 | }); |
|
| 106 | } |
|
| 107 | ||
| 108 | private function getReindexProductIdList($parameterNameId) |
|
| 109 | {
|
|
| @@ 42-57 (lines=16) @@ | ||
| 39 | /** |
|
| 40 | * @return string |
|
| 41 | */ |
|
| 42 | private function reindex() |
|
| 43 | {
|
|
| 44 | $reindexProductIdList = $this->getReindexProductIdList($this->owner->param_id); |
|
| 45 | $removeParameterNameId = $this->owner->param_id; |
|
| 46 | Yii::app()->attachEventHandler('onEndRequest', function($event) use($reindexProductIdList, $removeParameterNameId) {
|
|
| 47 | ViewHelper::showFlash('Индексация фильтра началсь и может занять несколько минут');
|
|
| 48 | ||
| 49 | Utils::finishRequest(); |
|
| 50 | Utils::longLife(60); |
|
| 51 | ||
| 52 | $facetIndexer = new FacetIndexer(); |
|
| 53 | ||
| 54 | $facetIndexer->clearIndexByParameterNameIdList(array($removeParameterNameId)); |
|
| 55 | $facetIndexer->reindexProducts($reindexProductIdList); |
|
| 56 | }); |
|
| 57 | } |
|
| 58 | ||
| 59 | private function getReindexProductIdList($parameterNameId) |
|
| 60 | {
|
|