|
24 | 24 | import com.google.firebase.firestore.model.DocumentKey;
|
25 | 25 | import com.google.firebase.firestore.model.MaybeDocument;
|
26 | 26 | import com.google.firebase.firestore.model.SnapshotVersion;
|
| 27 | +import com.google.firebase.firestore.util.Logger; |
27 | 28 | import java.util.Collections;
|
28 | 29 | import java.util.Map;
|
29 | 30 |
|
|
51 | 52 | * </ol>
|
52 | 53 | */
|
53 | 54 | public class IndexFreeQueryEngine implements QueryEngine {
|
| 55 | + private static final String LOG_TAG = "IndexFreeQueryEngine"; |
| 56 | + |
54 | 57 | private LocalDocumentsView localDocumentsView;
|
55 | 58 |
|
56 | 59 | @Override
|
@@ -83,6 +86,14 @@ && needsRefill(previousResults, remoteKeys, queryData.getLastLimboFreeSnapshotVe
|
83 | 86 | return executeFullCollectionScan(query);
|
84 | 87 | }
|
85 | 88 |
|
| 89 | + if (Logger.isDebugEnabled()) { |
| 90 | + Logger.debug( |
| 91 | + LOG_TAG, |
| 92 | + "Re-using previous result from %s to execute query: %s", |
| 93 | + queryData.getLastLimboFreeSnapshotVersion().toString(), |
| 94 | + query.toString()); |
| 95 | + } |
| 96 | + |
86 | 97 | // Retrieve all results for documents that were updated since the last limbo-document free
|
87 | 98 | // remote snapshot.
|
88 | 99 | ImmutableSortedMap<DocumentKey, Document> updatedResults =
|
@@ -161,6 +172,9 @@ public void handleDocumentChange(MaybeDocument oldDocument, MaybeDocument newDoc
|
161 | 172 | }
|
162 | 173 |
|
163 | 174 | private ImmutableSortedMap<DocumentKey, Document> executeFullCollectionScan(Query query) {
|
| 175 | + if (Logger.isDebugEnabled()) { |
| 176 | + Logger.debug(LOG_TAG, "Using full collection scan to execute query: %s", query.toString()); |
| 177 | + } |
164 | 178 | return localDocumentsView.getDocumentsMatchingQuery(query, SnapshotVersion.NONE);
|
165 | 179 | }
|
166 | 180 | }
|
0 commit comments