File tree 1 file changed +8
-1
lines changed
MailCore/Cache/ContactManager 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -127,9 +127,16 @@ public extension ContactManager {
127
127
/// - fetchLimit: limit the query by default to limit memory footprint
128
128
/// - Returns: The collection of matching contacts.
129
129
func frozenAddressBookContacts( matching string: String , fetchLimit: Int ? ) -> any Collection < AddressBook > {
130
- var lazyResults = fetchResults ( ofType: AddressBook . self) { partial in
130
+ let mergedContacts = fetchResults ( ofType: MergedContact . self) { partial in
131
131
partial
132
132
}
133
+
134
+ let mergedContactIds = Array ( mergedContacts. compactMap { $0. remoteAddressBookId } )
135
+
136
+ var lazyResults = fetchResults ( ofType: AddressBook . self) { partial in
137
+ partial. where { $0. id. in ( mergedContactIds) }
138
+ }
139
+
133
140
lazyResults = lazyResults
134
141
. filter ( Self . searchGroupContactInsensitivePredicate, string, string)
135
142
. freeze ( )
You can’t perform that action at this time.
0 commit comments