diff options
Diffstat (limited to 'Firestore/Source/Core/FSTQuery.mm')
-rw-r--r-- | Firestore/Source/Core/FSTQuery.mm | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/Firestore/Source/Core/FSTQuery.mm b/Firestore/Source/Core/FSTQuery.mm index c10b94d..43b6356 100644 --- a/Firestore/Source/Core/FSTQuery.mm +++ b/Firestore/Source/Core/FSTQuery.mm @@ -23,7 +23,6 @@ #import "Firestore/Source/Model/FSTDocument.h" #import "Firestore/Source/Model/FSTDocumentKey.h" #import "Firestore/Source/Model/FSTFieldValue.h" -#import "Firestore/Source/Model/FSTPath.h" #import "Firestore/Source/Util/FSTAssert.h" #include "Firestore/core/src/firebase/firestore/model/field_path.h" @@ -153,8 +152,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe NSComparisonResult comparison = FSTDocumentKeyComparator(document.key, refValue.value); return [self matchesComparison:comparison]; } else { - return [self - matchesValue:[document fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:self.field]]]; + return [self matchesValue:[document fieldForPath:self.field]]; } } @@ -220,8 +218,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe } - (BOOL)matchesDocument:(FSTDocument *)document { - FSTFieldValue *fieldValue = - [document fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:self.field]]; + FSTFieldValue *fieldValue = [document fieldForPath:self.field]; return fieldValue != nil && [fieldValue isEqual:[FSTNullValue nullValue]]; } @@ -267,8 +264,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe } - (BOOL)matchesDocument:(FSTDocument *)document { - FSTFieldValue *fieldValue = - [document fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:self.field]]; + FSTFieldValue *fieldValue = [document fieldForPath:self.field]; return fieldValue != nil && [fieldValue isEqual:[FSTDoubleValue nanValue]]; } @@ -338,10 +334,8 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe if (_field == FieldPath::KeyFieldPath()) { result = FSTDocumentKeyComparator(document1.key, document2.key); } else { - FSTFieldValue *value1 = - [document1 fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:self.field]]; - FSTFieldValue *value2 = - [document2 fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:self.field]]; + FSTFieldValue *value1 = [document1 fieldForPath:self.field]; + FSTFieldValue *value2 = [document2 fieldForPath:self.field]; FSTAssert(value1 != nil && value2 != nil, @"Trying to compare documents on fields that don't exist."); result = [value1 compare:value2]; @@ -434,8 +428,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe FSTReferenceValue *refValue = (FSTReferenceValue *)fieldValue; comparison = [refValue.value compare:document.key]; } else { - FSTFieldValue *docValue = - [document fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:sortOrderComponent.field]]; + FSTFieldValue *docValue = [document fieldForPath:sortOrderComponent.field]; FSTAssert(docValue != nil, @"Field should exist since document matched the orderBy already."); comparison = [fieldValue compare:docValue]; } @@ -590,9 +583,9 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe } } else { FSTAssert(!inequalityField || *inequalityField == *firstSortOrderField, - @"First orderBy %@ should match inequality field %@.", - util::WrapNSStringNoCopy(firstSortOrderField->CanonicalString()), - util::WrapNSStringNoCopy(inequalityField->CanonicalString())); + @"First orderBy %s should match inequality field %s.", + firstSortOrderField->CanonicalString().c_str(), + inequalityField->CanonicalString().c_str()); __block BOOL foundKeyOrder = NO; @@ -791,8 +784,7 @@ NSString *FSTStringFromQueryRelationOperator(FSTRelationFilterOperator filterOpe for (FSTSortOrder *orderBy in self.explicitSortOrders) { const FieldPath &fieldPath = orderBy.field; // order by key always matches - if (fieldPath != FieldPath::KeyFieldPath() && - [document fieldForPath:[FSTFieldPath fieldPathWithCPPFieldPath:fieldPath]] == nil) { + if (fieldPath != FieldPath::KeyFieldPath() && [document fieldForPath:fieldPath] == nil) { return NO; } } |