]> git.wh0rd.org Git - tt-rss.git/commitdiff
disable headline cache when searching
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 21 Nov 2007 10:34:06 +0000 (11:34 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 21 Nov 2007 10:34:06 +0000 (11:34 +0100)
backend.php
feedlist.js
functions.php
viewfeed.js

index 02b52e68aadf66f9599aab38442b911825dd8b9e..d68ede30a9817fa96664d14f2f32cd064a7df79f 100644 (file)
                $topmost_article_ids = $ret[0];
                $headlines_count = $ret[1];
                $returned_feed = $ret[2];
+               $disable_cache = $ret[3];
 
                print "]]></headlines>";
 
                $headlines_unread = getFeedUnread($link, $returned_feed);
 
                print "<headlines-unread value=\"$headlines_unread\"/>";
+               printf("<disable-cache value=\"%d\"/>", $disable_cache);
 
                if ($_GET["debug"]) $timing_info = print_checkpoint("10", $timing_info);
 
index 57bfdcd1e84bd40c868afd3a097648b76f855fd0..872709a10f5f71f507be5f1a75bdbc669d458f55 100644 (file)
@@ -36,6 +36,8 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
 
 //             if (!offset) page_offset = 0;
 
+               var force_nocache = false;
+
                var page_offset = 0;
 
                if (offset > 0) {
@@ -76,6 +78,9 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
                var toolbar_query = Form.serialize("main_toolbar_form");
 
                if (toolbar_form.query) {
+                       if (toolbar_form.query.value != "") {
+                               force_nocache = true;
+                       }
                        toolbar_form.query.value = "";
                }
 
@@ -86,6 +91,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
                        var search_query = Form.serialize("search_form");
                        query = query + "&" + search_query;
                        closeInfoBox(true);
+                       force_nocache = true;
                }
 
 //             debug("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat);
@@ -146,7 +152,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
                var unread_ctr = document.getElementById("FEEDU-" + feed);
                var cache_check = false;
 
-               if (unread_ctr && !page_offset) {
+               if (unread_ctr && !page_offset && !force_nocache) {
                        unread_ctr = unread_ctr.innerHTML;
 
                        var cache_prefix = "";
index 0dce414c909d354158022efca109843508242c6c..3644bc25d9e9b2b24664636151b897b667f93473 100644 (file)
        function outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view,
                                        $next_unread_feed, $offset) {
 
+               $disable_cache = false;
+
                $timing_info = getmicrotime();
 
                $topmost_article_ids = array();
                /// START /////////////////////////////////////////////////////////////////////////////////
 
                $search = db_escape_string($_GET["query"]);
+
+               if ($search) { 
+                       $disable_cache = true;
+               }
+
                $search_mode = db_escape_string($_GET["search_mode"]);
                $match_on = db_escape_string($_GET["match_on"]);
 
                        print "</div>";
                }
 
-               return array($topmost_article_ids, $headlines_count, $feed);
+               return array($topmost_article_ids, $headlines_count, $feed, $disable_cache);
        }
 
 // from here: http://www.roscripts.com/Create_tag_cloud-71.html
index 1968c37756492997c792ac5604afc005c2791b71..aa3a148374d4cf397d7a63b72b05f482b10623d7 100644 (file)
@@ -91,9 +91,11 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
                        var headlines = transport.responseXML.getElementsByTagName("headlines")[0];
                        var headlines_count_obj = transport.responseXML.getElementsByTagName("headlines-count")[0];
                        var headlines_unread_obj = transport.responseXML.getElementsByTagName("headlines-unread")[0];
+                       var disable_cache_obj = transport.responseXML.getElementsByTagName("disable-cache")[0];
 
                        var headlines_count = headlines_count_obj.getAttribute("value");
                        var headlines_unread = headlines_unread_obj.getAttribute("value");
+                       var disable_cache = disable_cache_obj.getAttribute("value") != "0";
 
                        if (headlines_count == 0) _infscroll_disable = 1;
        
@@ -115,8 +117,10 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
 
                                        cache_invalidate(cache_prefix + active_feed_id);
 
-                                       cache_inject(cache_prefix + active_feed_id,
-                                               headlines.firstChild.nodeValue, headlines_unread);
+                                       if (!disable_cache) {
+                                               cache_inject(cache_prefix + active_feed_id,
+                                                       headlines.firstChild.nodeValue, headlines_unread);
+                                       }
 
                                } else {
                                        debug("headlines_callback: returned no data");