Skip to content

Commit 2cb5492

Browse files
Make indexing public (#3476)
1 parent 54f6ee7 commit 2cb5492

File tree

5 files changed

+40
-3
lines changed

5 files changed

+40
-3
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.firebase.annotations;
16+
17+
import java.lang.annotation.ElementType;
18+
import java.lang.annotation.Target;
19+
20+
/**
21+
* Indicates that this object (class, method, etc) is experimental and that both its signature and
22+
* implementation are subject to change. An API marked with this annotation provides no guarantee of
23+
* API stability or backward-compatibility.
24+
*/
25+
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
26+
public @interface PreviewApi {}

firebase-firestore/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ Android changes are not released automatically. Ensure that changes are released
22
by opting into a release at
33
[go/firebase-android-release](http:go/firebase-android-release) (Googlers only).
44

5+
# Unreleased
6+
- [feature] Added experimental support for indexed query execution. Indexes can
7+
be enabled by invoking `FirebaseFirestore.setIndexConfiguration()` with the
8+
JSON index definition exported by the Firestore CLI. Queries against the
9+
cache are executed using an index once the asynchronous operation to generate
10+
the index entries completes.
11+
512
# 24.0.2
613
- [fixed] Fixed an issue of long grpc reconnection period, when App moves to
714
foreground after staying in background for a while.
815
- [fixed] Fixed an AppCheck issue that caused Firestore listeners to stop
916
working and receive a "Permission Denied" error. This issue only occurred for
1017
AppCheck users that set their expiration time to under an hour.
11-
- [fixed] Fixed a potential problem during Firestore's shutdown that prevented
18+
- [fixed] Fixed a potential problem during Firestore's shutdown that prevented
1219
the shutdown from proceeding if a network connection was opened right before.
1320
- [changed] Queries are now send to the backend before the SDK starts local
1421
processing, which reduces overall Query latency.

firebase-firestore/api.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ package com.google.firebase.firestore {
153153
method @NonNull public com.google.android.gms.tasks.Task<java.lang.Void> runBatch(@NonNull com.google.firebase.firestore.WriteBatch.Function);
154154
method @NonNull public <TResult> com.google.android.gms.tasks.Task<TResult> runTransaction(@NonNull com.google.firebase.firestore.Transaction.Function<TResult>);
155155
method public void setFirestoreSettings(@NonNull com.google.firebase.firestore.FirebaseFirestoreSettings);
156+
method @NonNull public com.google.android.gms.tasks.Task<java.lang.Void> setIndexConfiguration(@NonNull String);
156157
method public static void setLoggingEnabled(boolean);
157158
method @NonNull public com.google.android.gms.tasks.Task<java.lang.Void> terminate();
158159
method public void useEmulator(@NonNull String, int);

firebase-firestore/firebase-firestore.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ googleJavaFormat {
123123
}
124124

125125
dependencies {
126+
implementation project(':firebase-annotations')
126127
implementation project(':firebase-common')
127128
implementation project(':protolite-well-known-types')
128129
implementation project(':firebase-database-collection')

firebase-firestore/src/main/java/com/google/firebase/firestore/FirebaseFirestore.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.google.android.gms.tasks.TaskCompletionSource;
2828
import com.google.android.gms.tasks.Tasks;
2929
import com.google.firebase.FirebaseApp;
30+
import com.google.firebase.annotations.PreviewApi;
3031
import com.google.firebase.appcheck.interop.InternalAppCheckTokenProvider;
3132
import com.google.firebase.auth.internal.InternalAuthProvider;
3233
import com.google.firebase.emulators.EmulatedServiceSettings;
@@ -304,8 +305,9 @@ public FirebaseApp getApp() {
304305
* @return A task that resolves once all indices are successfully configured.
305306
* @throws IllegalArgumentException if the JSON format is invalid
306307
*/
307-
@VisibleForTesting
308-
Task<Void> setIndexConfiguration(String json) {
308+
@PreviewApi
309+
@NonNull
310+
public Task<Void> setIndexConfiguration(@NonNull String json) {
309311
ensureClientConfigured();
310312
Preconditions.checkState(
311313
settings.isPersistenceEnabled(), "Cannot enable indexes when persistence is disabled");

0 commit comments

Comments
 (0)