mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-10-04 02:44:22 +08:00
improve performance for searching with lots of threads
This commit is contained in:
parent
1cd7493bf3
commit
ca201c8dfe
1 changed files with 7 additions and 8 deletions
|
@ -918,15 +918,14 @@ class MailClient
|
||||||
$aSearchedUids = $this->GetUids($oParams->oCacher, $sSearch,
|
$aSearchedUids = $this->GetUids($oParams->oCacher, $sSearch,
|
||||||
$oMessageCollection->FolderName, $oMessageCollection->FolderHash);
|
$oMessageCollection->FolderName, $oMessageCollection->FolderHash);
|
||||||
if ($bUseThreads && !$oParams->iThreadUid) {
|
if ($bUseThreads && !$oParams->iThreadUid) {
|
||||||
$aUids = \array_filter($aUids, function($iUid) use ($aSearchedUids, $aAllThreads) {
|
$matchingThreadUids = [];
|
||||||
if (\in_array($iUid, $aSearchedUids)) {
|
foreach ($aAllThreads as $aMap) {
|
||||||
return true;
|
if (\array_intersect($aSearchedUids, $aMap)) {
|
||||||
}
|
$matchingThreadUids = \array_merge($matchingThreadUids, $aMap);
|
||||||
foreach ($aAllThreads as $aMap) {
|
|
||||||
if (\in_array($iUid, $aMap) && \array_intersect($aSearchedUids, $aMap)) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$aUids = \array_filter($aUids, function($iUid) use ($aSearchedUids, $matchingThreadUids) {
|
||||||
|
return \in_array($iUid, $aSearchedUids) || \in_array($iUid, $matchingThreadUids);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$aUids = \array_filter($aUids, function($iUid) use ($aSearchedUids) {
|
$aUids = \array_filter($aUids, function($iUid) use ($aSearchedUids) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue