mirror of
https://github.com/friendica/friendica
synced 2025-04-25 10:30:12 +00:00
Expiry post search index entries
This commit is contained in:
parent
919f97c9a0
commit
6389133575
12 changed files with 397 additions and 299 deletions
|
@ -1386,7 +1386,14 @@ class PostUpdate
|
|||
|
||||
$rows = 0;
|
||||
|
||||
$posts = Post::selectPosts(['uri-id', 'network', 'private'], ["`uri-id` < ? AND `gravity` IN (?, ?)", $id, Item::GRAVITY_COMMENT, Item::GRAVITY_PARENT], ['order' => ['uri-id' => true], 'limit' => 1000]);
|
||||
$condition = ["`uri-id` < ? AND `gravity` IN (?, ?)", $id, Item::GRAVITY_COMMENT, Item::GRAVITY_PARENT];
|
||||
|
||||
$limit = Post\SearchIndex::searchAgeDateLimit();
|
||||
if (!empty($limit)) {
|
||||
DBA::mergeConditions($condition, ["`created` > ?", $limit]);
|
||||
}
|
||||
|
||||
$posts = Post::selectPosts(['uri-id', 'network', 'private', 'created'], $condition, ['order' => ['uri-id' => true], 'limit' => 1000]);
|
||||
|
||||
if (DBA::errorNo() != 0) {
|
||||
Logger::error('Database error', ['no' => DBA::errorNo(), 'message' => DBA::errorMessage()]);
|
||||
|
@ -1395,7 +1402,7 @@ class PostUpdate
|
|||
|
||||
while ($post = Post::fetch($posts)) {
|
||||
$id = $post['uri-id'];
|
||||
Post\SearchIndex::insert($post['uri-id'], $post['network'], $post['private']);
|
||||
Post\SearchIndex::insert($post['uri-id'], $post['network'], $post['private'], $post['created'], true);
|
||||
++$rows;
|
||||
}
|
||||
DBA::close($posts);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue