File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
packages/firestore/src/local Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -873,18 +873,24 @@ export class IndexedDbIndexManager implements IndexManager {
873
873
const bounds : IndexEntry [ ] = [ ] ;
874
874
bounds . push ( lower ) ;
875
875
for ( const notInValue of notInValues ) {
876
- const sortsAfter = indexEntryComparator ( notInValue , lower ) ;
877
- const sortsBefore = indexEntryComparator ( notInValue , upper ) ;
876
+ const cpmToLower = indexEntryComparator ( notInValue , lower ) ;
877
+ const cmpToUpper = indexEntryComparator ( notInValue , upper ) ;
878
878
879
- if ( sortsAfter > 0 && sortsBefore < 0 ) {
879
+ if ( cpmToLower === 0 ) {
880
+ // `notInValue` is the lower bound. We therefore need to raise the bound
881
+ // to the next value.
882
+ bounds [ 0 ] = lower . successor ( ) ;
883
+ } else if ( cpmToLower > 0 && cmpToUpper < 0 ) {
884
+ // `notInValue` is in the middle of the range
880
885
bounds . push ( notInValue ) ;
881
886
bounds . push ( notInValue . successor ( ) ) ;
882
- } else if ( sortsAfter === 0 ) {
883
- // The lowest value in the range is excluded
884
- bounds [ 0 ] = lower . successor ( ) ;
885
- } else if ( sortsBefore === 0 ) {
886
- // The largest value in the range is excluded
887
+ } else if ( cmpToUpper === 0 ) {
888
+ // `notInValue` is the upper value. We therefore need to exclude the
889
+ // upper bound.
887
890
upperInclusive = false ;
891
+ } else {
892
+ // `notInValue` (and all following values) are out of the range
893
+ break ;
888
894
}
889
895
}
890
896
bounds . push ( upper ) ;
You can’t perform that action at this time.
0 commit comments