Skip to content

Commit 665d71f

Browse files
committed
Keep INDEXING_ENABLED flag since Web implementation is still incomplete.
1 parent 05522e2 commit 665d71f

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

packages/firestore/src/local/indexeddb_schema.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ import {
2828
import { EncodedResourcePath } from './encoded_resource_path';
2929
import { DbTimestampKey } from './indexeddb_sentinels';
3030

31+
// TODO(indexing): Remove this constant
32+
export const INDEXING_ENABLED = false;
33+
3134
export const INDEXING_SCHEMA_VERSION = 15;
3235

3336
/**
@@ -55,7 +58,7 @@ export const INDEXING_SCHEMA_VERSION = 15;
5558
* 15. Add indexing support.
5659
*/
5760

58-
export const SCHEMA_VERSION = INDEXING_SCHEMA_VERSION;
61+
export const SCHEMA_VERSION = INDEXING_ENABLED ? INDEXING_SCHEMA_VERSION : 14;
5962

6063
/**
6164
* Wrapper class to store timestamps (seconds and nanos) in IndexedDb objects.

packages/firestore/src/local/query_engine.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { Iterable } from '../util/misc';
4343
import { SortedSet } from '../util/sorted_set';
4444

4545
import { IndexManager, IndexType } from './index_manager';
46+
import { INDEXING_ENABLED } from './indexeddb_schema';
4647
import { LocalDocumentsView } from './local_documents_view';
4748
import { PersistencePromise } from './persistence_promise';
4849
import { PersistenceTransaction } from './persistence_transaction';
@@ -133,6 +134,10 @@ export class QueryEngine {
133134
transaction: PersistenceTransaction,
134135
query: Query
135136
): PersistencePromise<DocumentMap | null> {
137+
if (!INDEXING_ENABLED) {
138+
return PersistencePromise.resolve<DocumentMap | null>(null);
139+
}
140+
136141
if (queryMatchesAllDocuments(query)) {
137142
// Queries that match all documents don't benefit from using
138143
// key-based lookups. It is more efficient to scan all documents in a

packages/firestore/test/unit/local/query_engine.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ import { SnapshotVersion } from '../../../src/core/snapshot_version';
3030
import { View } from '../../../src/core/view';
3131
import { DocumentOverlayCache } from '../../../src/local/document_overlay_cache';
3232
import { IndexedDbPersistence } from '../../../src/local/indexeddb_persistence';
33-
import { INDEXING_SCHEMA_VERSION } from '../../../src/local/indexeddb_schema';
33+
import {
34+
INDEXING_ENABLED,
35+
INDEXING_SCHEMA_VERSION
36+
} from '../../../src/local/indexeddb_schema';
3437
import { LocalDocumentsView } from '../../../src/local/local_documents_view';
3538
import { MutationQueue } from '../../../src/local/mutation_queue';
3639
import { Persistence } from '../../../src/local/persistence';
@@ -518,6 +521,10 @@ function genericQueryEngineTest(
518521
return;
519522
}
520523

524+
if (!INDEXING_ENABLED) {
525+
return;
526+
}
527+
521528
it('combines indexed with non-indexed results', async () => {
522529
debugAssert(durable, 'Test requires durable persistence');
523530

0 commit comments

Comments
 (0)