Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
indexer.php
1<?php
2
4
9
15{
16
17
24 public static function indexLetters($lastId = null)
25 {
26 $timer = new Runtime\Timer(Runtime\Env::getJobExecutionTimeout(), 100);
27
28 $filter = [];
29 if ($lastId)
30 {
31 $filter['>ID'] = $lastId;
32 }
33 $list = Model\LetterTable::getList([
34 'filter' => $filter,
35 'order' => ['ID' => 'ASC']
36 ]);
37
38 $nextId = null;
39 foreach ($list as $item)
40 {
41 $letter = Entity\Letter::createInstanceByArray($item);
42 $letter->saveSearchIndex();
43
44 if ($timer->isElapsed())
45 {
46 $nextId = $item['ID'];
47 break;
48 }
49 }
50
51 if (!$nextId)
52 {
53 $hasIndex = Application::getConnection()->getIndexName(
54 Model\LetterTable::getTableName(),
55 ["SEARCH_CONTENT"],
56 true
57 ) !== null;
58
59 $entity = Model\LetterTable::getEntity();
60 $entity->enableFullTextIndex("SEARCH_CONTENT", $hasIndex);
61 }
62
63 return $nextId;
64 }
65
72 public static function indexLettersAgent($lastId = null)
73 {
74 $nextId = self::indexLetters($lastId);
75 if (!$nextId)
76 {
77 return '';
78 }
79
80 return "\\" . __CLASS__ . "::indexLettersAgent($nextId);";
81 }
82}
static getConnection($name="")
static indexLetters($lastId=null)
Definition indexer.php:24
static indexLettersAgent($lastId=null)
Definition indexer.php:72