Merge pull request #8267 from nextcloud/8206_13

[stable13] Better result handling of email search
This commit is contained in:
Morris Jobke 2018-02-20 23:54:16 +01:00 committed by GitHub
commit 58cc34b816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View File

@ -173,6 +173,8 @@ class MailPlugin implements ISearchPlugin {
if (!$this->shareeEnumeration) {
$result['wide'] = [];
} else {
$result['wide'] = array_slice($result['wide'], $offset, $limit);
}
if (!$searchResult->hasExactIdMatch($emailType) && filter_var($search, FILTER_VALIDATE_EMAIL)) {

View File

@ -102,6 +102,8 @@ class RemotePlugin implements ISearchPlugin {
if (!$this->shareeEnumeration) {
$result['wide'] = [];
} else {
$result['wide'] = array_slice($result['wide'], $offset, $limit);
}
if (!$searchResult->hasExactIdMatch($resultType) && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) {

View File

@ -103,7 +103,7 @@ class MailPluginTest extends TestCase {
->with($searchTerm, ['EMAIL', 'FN'])
->willReturn($contacts);
$moreResults = $this->plugin->search($searchTerm, 0, 0, $this->searchResult);
$moreResults = $this->plugin->search($searchTerm, 2, 0, $this->searchResult);
$result = $this->searchResult->asArray();
$this->assertSame($exactIdMatch, $this->searchResult->hasExactIdMatch(new SearchResultType('emails')));
@ -398,7 +398,7 @@ class MailPluginTest extends TestCase {
return in_array($group, $userToGroupMapping[$userId]);
});
$moreResults = $this->plugin->search($searchTerm, 0, 0, $this->searchResult);
$moreResults = $this->plugin->search($searchTerm, 2, 0, $this->searchResult);
$result = $this->searchResult->asArray();
$this->assertSame($exactIdMatch, $this->searchResult->hasExactIdMatch(new SearchResultType('emails')));

View File

@ -94,7 +94,7 @@ class RemotePluginTest extends TestCase {
->with($searchTerm, ['CLOUD', 'FN'])
->willReturn($contacts);
$moreResults = $this->plugin->search($searchTerm, 0, 0, $this->searchResult);
$moreResults = $this->plugin->search($searchTerm, 2, 0, $this->searchResult);
$result = $this->searchResult->asArray();
$this->assertSame($exactIdMatch, $this->searchResult->hasExactIdMatch(new SearchResultType('remotes')));