Skip to content

Commit d21d094

Browse files
Address feedback
1 parent 9790656 commit d21d094

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/local/IndexFreeQueryEngine.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ private boolean needsRefill(
143143
return false;
144144
}
145145

146-
// Limit queries are not eligible for index-free query execution if an older document from cache
147-
// may sort before a document that was previously part of the limit. This can happen if the last
148-
// document of the limit could sort lower than it did when the query was last synchronized. To
149-
// verify this, we use the query's comparator to determine the last document that fit the
150-
// limit. If the last document was edited after the query was last synchronized, there is a
151-
// chance that another document from cache sorts higher, in which case we have to perform a full
152-
// cache scan.
146+
// Limit queries are not eligible for index-free query execution if there is a potential that an
147+
// older document from cache now sorts before a document that was previously part of the limit.
148+
// This, however, can only happen if the last document of the limit sorts lower than it did when
149+
// the query was last synchronized. If a document that is not the limit boundary sorts
150+
// differently, the boundary of the limit itself did not change and documents from cache will
151+
// continue to be "rejected" by the boundary. Therefore, we can ignore any modifications that
152+
// don't affect the last document.
153153
Document lastDocumentInLimit = sortedPreviousResults.getMaxEntry();
154154
return lastDocumentInLimit.hasPendingWrites()
155155
|| lastDocumentInLimit.getVersion().compareTo(limboFreeSnapshotVersion) > 0;

0 commit comments

Comments
 (0)