Option to reduced search scope to improve the performance

This commit is contained in:
Michael 2024-06-02 09:27:05 +00:00
parent d7e038a014
commit 259a676207
11 changed files with 349 additions and 260 deletions

View file

@ -124,7 +124,7 @@ class Content
'limit' => [$start, $limit]
];
$tags = DBA::select('post-searchindex', ['uri-id'], $condition, $params);
$tags = DBA::select(SearchIndex::getSearchTable(), ['uri-id'], $condition, $params);
$uriids = [];
while ($tag = DBA::fetch($tags)) {
@ -143,6 +143,6 @@ class Content
} else {
$condition = ["MATCH (`searchtext`) AGAINST (? IN BOOLEAN MODE) AND NOT `restricted", $search];
}
return DBA::count('post-searchindex', $condition);
return DBA::count(SearchIndex::getSearchTable(), $condition);
}
}

View file

@ -99,4 +99,14 @@ class SearchIndex
}
return DateTimeFormat::utc('now - ' . $days . ' day');
}
public static function getSearchTable(): string
{
return DI::config()->get('system', 'limited_search_scope') ? 'post-engagement' : 'post-searchindex';
}
public static function getSearchView(): string
{
return DI::config()->get('system', 'limited_search_scope') ? 'post-engagement-user-view' : 'post-searchindex-user-view';
}
}