Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
indexer.php
1
<?php
2
3
namespace
Bitrix\Sender\Search
;
4
5
use
Bitrix\Sender\Entity
;
6
use
Bitrix\Sender\Runtime
;
7
use
Bitrix\Sender\Internals\Model
;
8
use
Bitrix\Main\Application
;
9
14
class
Indexer
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
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
Bitrix\Sender\Runtime\Timer
Definition
timer.php:16
Bitrix\Sender\Search\Indexer
Definition
indexer.php:15
Bitrix\Sender\Search\Indexer\indexLetters
static indexLetters($lastId=null)
Definition
indexer.php:24
Bitrix\Sender\Search\Indexer\indexLettersAgent
static indexLettersAgent($lastId=null)
Definition
indexer.php:72
Bitrix\Sender\Entity
Definition
ad.php:8
Bitrix\Sender\Internals\Model
Definition
abuse.php:3
Bitrix\Sender\Runtime
Definition
env.php:9
Bitrix\Sender\Search
Definition
builder.php:3
modules
sender
lib
search
indexer.php
Создано системой
1.10.0