From 1c40e7aada6b32bbc621f06fb5f380149606a58d Mon Sep 17 00:00:00 2001 From: zxu Date: Mon, 5 Mar 2018 11:30:59 -0500 Subject: add converters and port paths to FSTQuery (#869) * add converters and fix FSTQuery.{h,m} only * address changes * a change forget to address * add a dummy function to make inline-only-library buildable --- Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.mm') diff --git a/Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.mm b/Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.mm index b842cb5..17ecb53 100644 --- a/Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.mm +++ b/Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.mm @@ -104,7 +104,8 @@ static ReadOptions StandardReadOptions() { // Documents are ordered by key, so we can use a prefix scan to narrow down // the documents we need to match the query against. - std::string startKey = [FSTLevelDBRemoteDocumentKey keyPrefixWithResourcePath:query.path]; + std::string startKey = [FSTLevelDBRemoteDocumentKey + keyPrefixWithResourcePath:[FSTResourcePath resourcePathWithCPPResourcePath:query.path]]; std::unique_ptr it(_db->NewIterator(StandardReadOptions())); it->Seek(startKey); @@ -112,7 +113,7 @@ static ReadOptions StandardReadOptions() { for (; it->Valid() && [currentKey decodeKey:it->key()]; it->Next()) { FSTMaybeDocument *maybeDoc = [self decodedMaybeDocument:it->value() withKey:currentKey.documentKey]; - if (![query.path isPrefixOfPath:maybeDoc.key.path]) { + if (!query.path.IsPrefixOf([maybeDoc.key.path toCPPResourcePath])) { break; } else if ([maybeDoc isKindOfClass:[FSTDocument class]]) { results = [results dictionaryBySettingObject:(FSTDocument *)maybeDoc forKey:maybeDoc.key]; -- cgit v1.2.3