]> git.wh0rd.org - tt-rss.git/blobdiff - include/rssfuncs.php
more fts stuff for simple index
[tt-rss.git] / include / rssfuncs.php
index 7a3ea7402cf725a638150c954f8f77c511fd33dc..5ebddf9eff4ef609ef46ae685e89ec29b4beda3f 100644 (file)
                _debug_suppress(!$debug_enabled);
                _debug("start", $debug_enabled);
 
+               $result = db_query("SELECT title FROM ttrss_feeds
+                       WHERE id = '$feed'");
+               $title = db_fetch_result($result, 0, "title");
+
+               // feed was batch-subscribed or something, we need to get basic info
+               // this is not optimal currently as it fetches stuff separately TODO: optimize
+               if ($title == "[Unknown]") {
+                       _debug("setting basic feed info for $feed...");
+                       set_basic_feed_info($feed);
+               }
+
                $result = db_query("SELECT id,update_interval,auth_login,
                        feed_url,auth_pass,cache_images,
                        mark_unread_on_update, owner_uid,
                                // Workaround: 4-byte unicode requires utf8mb4 in MySQL. See https://tt-rss.org/forum/viewtopic.php?f=1&t=3377&p=20077#p20077
                                if (DB_TYPE == "mysql") {
                                        foreach ($article as $k => $v) {
-                                               $article[$k] = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $v);
+
+                                               // i guess we'll have to take the risk of 4byte unicode labels & tags here
+                                               if (!is_array($article[$k])) {
+                                                       $article[$k] = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $v);
+                                               }
                                        }
                                }
 
 
                                        _debug("RID: $entry_ref_id, IID: $entry_int_id", $debug_enabled);
 
+                                       if (DB_TYPE == "pgsql") {
+                                               $tsvector_combined = db_escape_string(mb_substr($entry_title . ' ' . strip_tags($entry_content),
+                                                       0, 1000000));
+
+                                               $tsvector_qpart = "tsvector_combined = to_tsvector('simple', '$tsvector_combined'),";
+
+                                       } else {
+                                               $tsvector_qpart = "";
+                                       }
+
                                        db_query("UPDATE ttrss_entries
                                                SET title = '$entry_title',
                                                        content = '$entry_content',
                                                        content_hash = '$entry_current_hash',
                                                        updated = '$entry_timestamp_fmt',
+                                                       $tsvector_qpart
                                                        num_comments = '$num_comments',
                                                        plugin_data = '$entry_plugin_data',
                                                        author = '$entry_author',