@@ -68,7 +68,7 @@ final class SQLiteIndexManager implements IndexManager {
68
68
69
69
private final SQLitePersistence db ;
70
70
private final LocalSerializer serializer ;
71
- private final User user ;
71
+ private final String uid ;
72
72
private final Map <String , Map <Integer , FieldIndex >> memoizedIndexes ;
73
73
74
74
private boolean started = false ;
@@ -77,7 +77,7 @@ final class SQLiteIndexManager implements IndexManager {
77
77
SQLiteIndexManager (SQLitePersistence persistence , LocalSerializer serializer , User user ) {
78
78
this .db = persistence ;
79
79
this .serializer = serializer ;
80
- this .user = user ;
80
+ this .uid = user . isAuthenticated () ? user . getUid () : "" ;
81
81
this .memoizedIndexes = new HashMap <>();
82
82
}
83
83
@@ -376,7 +376,7 @@ private void addSingleEntry(
376
376
"INSERT INTO index_entries (index_id, uid, array_value, directional_value, document_name) "
377
377
+ "VALUES(?, ?, ?, ?, ?)" ,
378
378
indexId ,
379
- document . hasLocalMutations () ? user . getUid () : null ,
379
+ uid ,
380
380
arrayValue ,
381
381
directionalValue ,
382
382
document .getKey ().toString ());
@@ -450,7 +450,7 @@ private SQLitePersistence.Query generateQuery(
450
450
// and an upper bound.
451
451
StringBuilder statement = new StringBuilder ();
452
452
statement .append ("SELECT document_name, directional_value FROM index_entries " );
453
- statement .append ("WHERE index_id = ? AND ( uid IS NULL or uid = ?) " );
453
+ statement .append ("WHERE index_id = ? AND uid = ? " );
454
454
if (arrayValues != null ) {
455
455
statement .append ("AND array_value = ? " );
456
456
}
@@ -504,7 +504,7 @@ private Object[] fillBounds(
504
504
int offset = 0 ;
505
505
for (int i = 0 ; i < statementCount ; ++i ) {
506
506
bindArgs [offset ++] = indexId ;
507
- bindArgs [offset ++] = user . getUid () ;
507
+ bindArgs [offset ++] = uid ;
508
508
if (arrayValues != null ) {
509
509
bindArgs [offset ++] = encodeSingleElement (arrayValues .get (i / statementsPerArrayValue ));
510
510
}
0 commit comments