Last active
April 15, 2019 11:21
-
-
Save anoriar/0ee3ca3ec79effdef2a9017245de9365 to your computer and use it in GitHub Desktop.
search reindex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| На всякий случай: | |
| http://epages.su/blog/dobavlenie-v-rezultat-poiska-1s-bitriks-neaktivnye-elementy-infobloka.html | |
| https://bxapi.ru/src/?module_id=iblock&name=CIBlock%3A%3AOnSearchReindex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| в методе setupEventHandlers() | |
| $eventManager->addEventHandler( | |
| "search", | |
| "BeforeIndex", | |
| [ | |
| "Aero\Tools\Search", | |
| "BeforeIndexHandler" | |
| ] | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace Aero\Tools; | |
| class Search{ | |
| function BeforeIndexHandler($arFields) | |
| { | |
| if($arFields["MODULE_ID"] == "iblock" && $arFields["ITEM_ID"] == 3228187) | |
| { | |
| //test test - то, что вводит пользователь, на него будет отображаться артикул 3228187 | |
| $arFields['BODY'] = 'test test'; | |
| } | |
| return $arFields; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Индексация поиска элемента с ID 3228187 | |
| \Bitrix\Main\Loader::includeModule('search'); | |
| $test = CSearch::Index( | |
| "iblock", | |
| 3228187 , | |
| Array( | |
| "SITE_ID"=>'s1', | |
| ), | |
| true | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment