[pan2: 19/68] Skip non-overview test if not cached.



commit 9a35c698354970863cb26ed784e8d4f4ac6835fc
Author: K. Haley <haleykd users sf net>
Date:   Mon Mar 22 23:43:36 2010 -0600

    Skip non-overview test if not cached.
    
    Allow article tests to be skipped with appropriate pass/fail result when article is needed but not cached.

 pan/data-impl/article-filter.cc |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/pan/data-impl/article-filter.cc b/pan/data-impl/article-filter.cc
index f5a9e45..3d0b827 100644
--- a/pan/data-impl/article-filter.cc
+++ b/pan/data-impl/article-filter.cc
@@ -56,10 +56,12 @@ ArticleFilter :: test_article (const Data        & data,
     case FilterInfo::AGGREGATE_AND:
       pass = true;
       foreach_const (FilterInfo::aggregates_t, criteria._aggregates, it) {
-        if (!test_article (data, *it, group, article)) {
-          pass = false;
-          break;
-        }
+        // assume test passes if test needs body but article not cached
+        if (!it->_needs_body || cache.contains(article.message_id) )
+          if (!test_article (data, *it, group, article)) {
+            pass = false;
+            break;
+          }
       }
       break;
 
@@ -69,10 +71,12 @@ ArticleFilter :: test_article (const Data        & data,
       else {
         pass = false;
         foreach_const (FilterInfo::aggregates_t, criteria._aggregates, it) {
-          if (test_article (data, *it, group, article)) {
-            pass = true;
-            break;
-          }
+          // assume test fails if test needs body but article not cached
+          if (!it->_needs_body || cache.contains(article.message_id) )
+            if (test_article (data, *it, group, article)) {
+              pass = true;
+              break;
+            }
         }
       }
       break;
@@ -120,7 +124,7 @@ ArticleFilter :: test_article (const Data        & data,
         }
         else if (criteria._text._impl_text.find("(.*:){") != std::string::npos) // user is filtering by # of crossposts
         {
-          const char * search = "(.*:){";
+          const char * search = "(.*:){";//}
           std::string::size_type pos = criteria._text._impl_text.find (search) + strlen(search);
           const int ge = atoi (criteria._text._impl_text.c_str() + pos);
           FilterInfo tmp;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]