-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ordered intervals query over interleaved terms (#12214)
Given an input text 'A B A C A B C' and search ORDERED(A, B, C), we should retrieve hits [0,3] and [4,6]; currently [4,6] is skipped. After finding the first interval [0, 3], the subintervals will become A[0,0], B[1,1], C[3,3]; then the algorithm will try to minimize it and the subintervals will become: A:[2,2], B:[5,5], C:[3,3] (after finding 5 > 3 it breaks the minimization) And when finding next interval, it will do advance(B) before checking whether it is after A(the do-while loop), so subintervals will become A[2,2], B[inf, inf], C[3,3] and return NO_MORE_INTERVAL. This commit instead continues advancing subintervals from where the last `nextInterval` call stopped, rather than always advancing all subintervals.
- Loading branch information
1 parent
8a81515
commit e7648cf
Showing
3 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters