Remove shared index entries
@@ -68,7 +68,7 @@ final class SQLiteIndexManager implements IndexManager {
private final SQLitePersistence db;
private final LocalSerializer serializer;
- private final User user;
+ private final String uid;
private final Map<String, Map<Integer, FieldIndex>> memoizedIndexes;
private boolean started = false;
@@ -77,7 +77,7 @@ final class SQLiteIndexManager implements IndexManager {
SQLiteIndexManager(SQLitePersistence persistence, LocalSerializer serializer, User user) {
this.db = persistence;
this.serializer = serializer;
- this.user = user;
+ this.uid = user.isAuthenticated() ? user.getUid() : "";
this.memoizedIndexes = new HashMap<>();
}
@@ -376,7 +376,7 @@ final class SQLiteIndexManager implements IndexManager {
"INSERT INTO index_entries (index_id, uid, array_value, directional_value, document_name) "
+ "VALUES(?, ?, ?, ?, ?)",
indexId,
- document.hasLocalMutations() ? user.getUid() : null,
+ uid,
arrayValue,
directionalValue,
document.getKey().toString());
@@ -450,7 +450,7 @@ final class SQLiteIndexManager implements IndexManager {
// and an upper bound.
StringBuilder statement = new StringBuilder();
statement.append("SELECT document_name, directional_value FROM index_entries ");
- statement.append("WHERE index_id = ? AND (uid IS NULL or uid = ?) ");
+ statement.append("WHERE index_id = ? AND uid = ? ");
if (arrayValues != null) {
statement.append("AND array_value = ? ");
}
@@ -504,7 +504,7 @@ final class SQLiteIndexManager implements IndexManager {
int offset = 0;
for (int i = 0; i < statementCount; ++i) {
bindArgs[offset++] = indexId;
- bindArgs[offset++] = user.getUid();
+ bindArgs[offset++] = uid;
if (arrayValues != null) {
bindArgs[offset++] = encodeSingleElement(arrayValues.get(i / statementsPerArrayValue));
}
