Check if db exists before using for search

This commit is contained in:
Retro_Guy 2021-10-30 09:14:13 +00:00
parent ea7476dd66
commit dbf2f4e63d
1 changed files with 3 additions and 0 deletions

View File

@ -284,6 +284,9 @@ function get_body_search($group, $terms) {
$name = explode(':', $thisgroup);
$group=$name[0];
$database = $spooldir.'/'.$group.'-articles.db3';
if(!is_file($database)) {
continue;
}
$dbh = article_db_open($database);
$stmt = $dbh->prepare("SELECT snippet(search_fts, 6, '<strong><font class=search_result><i>', '</i></font></strong>', '...', $snippet_size) as snippet, newsgroup, number, name, date, subject, rank FROM search_fts WHERE search_fts MATCH 'search_snippet:$terms' ORDER BY rank");
$stmt->execute();