summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-01-20 09:33:58 +0100
committerThomas Bruederli <thomas@roundcube.net>2014-01-20 09:33:58 +0100
commit689a222170aed32165cbe8bc8fc89fd428b29186 (patch)
tree412613e3e532733930c9f8a750546f2e2c2fcc1a
parentff3eb834920e2ec04e24423b5f87bdf4d3064eeb (diff)
Append per-folder search results to global index but only if it has matches
-rw-r--r--program/lib/Roundcube/rcube_result_multifolder.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/program/lib/Roundcube/rcube_result_multifolder.php b/program/lib/Roundcube/rcube_result_multifolder.php
index 277a6d1ea..188fb26f2 100644
--- a/program/lib/Roundcube/rcube_result_multifolder.php
+++ b/program/lib/Roundcube/rcube_result_multifolder.php
@@ -52,8 +52,15 @@ class rcube_result_multifolder
*/
public function add($result)
{
- $this->sets[] = $result;
- $this->meta['count'] += $result->count();
+ if ($count = $result->count()) {
+ $this->sets[] = $result;
+ $this->meta['count'] += $count;
+
+ // append UIDs to global index
+ $folder = $result->get_parameters('MAILBOX');
+ $index = array_map(function($uid) use ($folder) { return $uid . '-' . $folder; }, $result->get());
+ $this->index = array_merge($this->index, $index);
+ }
}
/**