L
L
lie22020-03-05 10:08:02
1C-Bitrix
lie2, 2020-03-05 10:08:02

What to do if reindexing does not work?

Good day everyone!
The problem I am writing about is: search reindexing does not work (Settings - Search - Reindexing) leads to a 404 page in the admin panel ... in the search bar the text: https://www.hors.by/bitrix/admin/search_re
image.png
I.e. it turns out that it somehow itself removes the rest of index.php .
I tried to trick the system and created a copy of search_reindex.php with the name search_re.php, but when called, something goes wrong, the admin panel opens in the admin panel and it seems to me that it does not work ....
1.png

As for the reasons for this question, then Here's what: I
set up a search in the Catalog, removed the description from the search and added the following code:

AddEventHandler("search", "BeforeIndex", "BeforeIndexHandler");
  function BeforeIndexHandler($arFields) {
      $arrIblock = array(11);
      $arDelFields = array("DETAIL_TEXT", "PREVIEW_TEXT") ;
      if (CModule::IncludeModule('iblock') && $arFields["MODULE_ID"] == 'iblock' && in_array($arFields["PARAM2"], $arrIblock) && intval($arFields["ITEM_ID"]) > 0){
      $dbElement = CIblockElement::GetByID($arFields["ITEM_ID"]) ;
      if ($arElement = $dbElement->Fetch()){
          foreach ($arDelFields as $value){
          if (isset ($arElement[$value]) && strlen($arElement[$value]) > 0){
              $arFields["BODY"] = str_replace (CSearch::KillTags($arElement[$value]) , "", CSearch::KillTags($arFields["BODY"]) );
              }
          }
      }
      return $arFields;
      }
  }

After that, reindexing is needed, because. I manually updated a couple of products and they disappeared from the search, which means everything works...
Then I started looking for a solution to problems with reindexing and found the following solution: https://thisis-blog.ru/pereindeksaciya-sajta-na-1s... .
I did everything as it was, but for some reason it didn’t work ... I decided to make the smartest (at that time) idea and added it to the code
function BeforeIndexHandler($arFields) {
      $arrIblock = array(11);
      $arDelFields = array("DETAIL_TEXT", "PREVIEW_TEXT") ;
also a reindexing line: $Result = CSearch::ReIndexAll(true, 60);
And here I was cursed: the search now does not work and gives the text: "Sorry, but nothing was found." or "Sorry, no results were found for your search query." (depending on what I'm looking for), in the title, of course, nothing works either ....

I just broke the site and now I don't know what to do ... I hope that as soon as I can do the reindexing (correctly), everything will return back to normal ....

Help, please ...

I'll add:
Now I've updated (resaved) a couple of product positions and they are displayed in the search!
Conclusion: you need to set up / do reindexing.
But how then to update the products ... Re-indexing the search will help?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lie2, 2020-03-10
@lie2

Resolved
Removed the line.
It didn’t go right away, because indeed the cache was clogged

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question