@@ -847,29 +847,27 @@ export class IndexedDbIndexManager implements IndexManager {
847
847
return indexRanges ;
848
848
}
849
849
850
- // The values need to be sorted so that we can return a sorted set of
851
- // non-overlapping ranges.
852
- notInValues . sort ( ( l , r ) => compareByteArrays ( l , r ) ) ;
853
-
854
- const notInRanges : IDBKeyRange [ ] = [ ] ;
850
+ const result : IDBKeyRange [ ] = [ ] ;
855
851
for ( const indexRange of indexRanges ) {
856
852
// Remove notIn values that are not applicable to this index range
853
+ const lowerBound = new Uint8Array ( indexRange . lower [ 3 ] ) ;
854
+ const upperBound = new Uint8Array ( indexRange . upper [ 3 ] ) ;
857
855
const filteredRanges = notInValues . filter (
858
856
v =>
859
- compareByteArrays ( v , new Uint8Array ( indexRange . lower [ 3 ] ) ) >= 0 &&
860
- compareByteArrays ( v , new Uint8Array ( indexRange . upper [ 3 ] ) ) <= 0
857
+ compareByteArrays ( v , lowerBound ) >= 0 &&
858
+ compareByteArrays ( v , upperBound ) <= 0
861
859
) ;
862
860
863
861
if ( filteredRanges . length === 0 ) {
864
- notInRanges . push ( indexRange ) ;
862
+ result . push ( indexRange ) ;
865
863
} else {
866
864
// Use the existing bounds and interleave the notIn values. This means
867
865
// that we would split an existing range into multiple ranges that exclude
868
866
// the values from any notIn filter.
869
- notInRanges . push ( ...this . interleaveRanges ( indexRange , filteredRanges ) ) ;
867
+ result . push ( ...this . interleaveRanges ( indexRange , filteredRanges ) ) ;
870
868
}
871
869
}
872
- return notInRanges ;
870
+ return result ;
873
871
}
874
872
875
873
/**
@@ -881,6 +879,10 @@ export class IndexedDbIndexManager implements IndexManager {
881
879
indexRange : IDBKeyRange ,
882
880
barriers : Uint8Array [ ]
883
881
) : IDBKeyRange [ ] {
882
+ // The values need to be sorted so that we can return a sorted set of
883
+ // non-overlapping ranges.
884
+ barriers . sort ( ( l , r ) => compareByteArrays ( l , r ) ) ;
885
+
884
886
const ranges : IDBKeyRange [ ] = [ ] ;
885
887
886
888
// The first index range starts with the lower bound and ends before the
0 commit comments