+ if (isset($options["gen-search-idx"])) {
+ echo "Generating search index (stemming set to English)...\n";
+
+ $res = $pdo->query("SELECT COUNT(id) AS count FROM ttrss_entries WHERE tsvector_combined IS NULL");
+ $row = $res->fetch();
+ $count = $row['count'];
+
+ print "Articles to process: $count.\n";
+
+ $limit = 500;
+ $processed = 0;
+
+ $sth = $pdo->prepare("SELECT id, title, content FROM ttrss_entries WHERE
+ tsvector_combined IS NULL ORDER BY id LIMIT ?");
+ $sth->execute([$limit]);
+
+ $usth = $pdo->prepare("UPDATE ttrss_entries
+ SET tsvector_combined = to_tsvector('english', ?) WHERE id = ?");
+
+ while (true) {
+
+ while ($line = $sth->fetch()) {
+ $tsvector_combined = mb_substr(strip_tags($line["title"] . " " . $line["content"]), 0, 1000000);
+
+ $usth->execute([$tsvector_combined, $line['id']]);
+
+ $processed++;
+ }
+
+ print "Processed $processed articles...\n";
+
+ if ($processed < $limit) {
+ echo "All done.\n";
+ break;
+ }
+ }
+ }
+