Merge commit 'jeff-themovie/notice-search-no-results' into 0.8.x
* commit 'jeff-themovie/notice-search-no-results': Fixes the notice search RSS feeds / API results for searches that return no matches.
This commit is contained in:
		@@ -67,12 +67,17 @@ class NoticesearchrssAction extends Rss10Action
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (!$limit) $limit = 20;
 | 
					        if (!$limit) $limit = 20;
 | 
				
			||||||
        $search_engine->limit(0, $limit, true);
 | 
					        $search_engine->limit(0, $limit, true);
 | 
				
			||||||
        $search_engine->query($q);
 | 
					        if (false === $search_engine->query($q)) {
 | 
				
			||||||
        $notice->find();
 | 
					            $cnt = 0;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $cnt = $notice->find();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($cnt > 0) {
 | 
				
			||||||
            while ($notice->fetch()) {
 | 
					            while ($notice->fetch()) {
 | 
				
			||||||
                $notices[] = clone($notice);
 | 
					                $notices[] = clone($notice);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $notices;
 | 
					        return $notices;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -165,11 +165,15 @@ class TwitapisearchatomAction extends TwitterapiAction
 | 
				
			|||||||
        $search_engine->set_sort_mode('chron');
 | 
					        $search_engine->set_sort_mode('chron');
 | 
				
			||||||
        $search_engine->limit(($this->page - 1) * $this->rpp,
 | 
					        $search_engine->limit(($this->page - 1) * $this->rpp,
 | 
				
			||||||
            $this->rpp + 1, true);
 | 
					            $this->rpp + 1, true);
 | 
				
			||||||
        $search_engine->query($q);
 | 
					        if (false === $search_engine->query($q)) {
 | 
				
			||||||
 | 
					            $this->cnt = 0;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
            $this->cnt = $notice->find();
 | 
					            $this->cnt = $notice->find();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $cnt = 0;
 | 
					        $cnt = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($this->cnt > 0) {
 | 
				
			||||||
            while ($notice->fetch()) {
 | 
					            while ($notice->fetch()) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                ++$cnt;
 | 
					                ++$cnt;
 | 
				
			||||||
@@ -184,6 +188,7 @@ class TwitapisearchatomAction extends TwitterapiAction
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                $notices[] = clone($notice);
 | 
					                $notices[] = clone($notice);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $notices;
 | 
					        return $notices;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -124,8 +124,11 @@ class TwitapisearchjsonAction extends TwitterapiAction
 | 
				
			|||||||
        $search_engine = $notice->getSearchEngine('identica_notices');
 | 
					        $search_engine = $notice->getSearchEngine('identica_notices');
 | 
				
			||||||
        $search_engine->set_sort_mode('chron');
 | 
					        $search_engine->set_sort_mode('chron');
 | 
				
			||||||
        $search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1, true);
 | 
					        $search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1, true);
 | 
				
			||||||
        $search_engine->query($q);
 | 
					        if (false === $search_engine->query($q)) {
 | 
				
			||||||
 | 
					            $cnt = 0;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
            $cnt = $notice->find();
 | 
					            $cnt = $notice->find();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // TODO: since_id, lang, geocode
 | 
					        // TODO: since_id, lang, geocode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user