-
Notifications
You must be signed in to change notification settings - Fork 55
Add SeekForwardPosition API to TextIterator interface and all the derived iterators #620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: KarthikSubbarao <[email protected]>
…imityiterator Signed-off-by: KarthikSubbarao <[email protected]>
Signed-off-by: KarthikSubbarao <[email protected]>
Signed-off-by: KarthikSubbarao <[email protected]>
Signed-off-by: KarthikSubbarao <[email protected]>
Signed-off-by: KarthikSubbarao <[email protected]>
Signed-off-by: KarthikSubbarao <[email protected]>
src/indexes/text/proximity.cc
Outdated
| } | ||
| // No violations: advance the term appearing first physically | ||
| size_t first_idx = in_order_ ? 0 : pos_with_idx_[0].second; | ||
| if (!iters_[first_idx]->DonePositions()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would happen if the iterator is exhausted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it was exhausted, then we should not try advancing, since it is against the contract (and can crash). There is a check at the top in the loop condition which will exit if any iterator is done once the curr iteration is done
Signed-off-by: KarthikSubbarao <[email protected]>
Signed-off-by: KarthikSubbarao <[email protected]>
…ived iterators (valkey-io#620) * seekforwardposition Signed-off-by: KarthikSubbarao <[email protected]> * implement seekforward for unordered positions case and also in orproximityiterator Signed-off-by: KarthikSubbarao <[email protected]> * updates Signed-off-by: KarthikSubbarao <[email protected]> * Cleaning code Signed-off-by: KarthikSubbarao <[email protected]> * Refactor Signed-off-by: KarthikSubbarao <[email protected]> * cleanup Signed-off-by: KarthikSubbarao <[email protected]> * Add comment Signed-off-by: KarthikSubbarao <[email protected]> * fix Signed-off-by: KarthikSubbarao <[email protected]> * Remove noop check Signed-off-by: KarthikSubbarao <[email protected]> --------- Signed-off-by: KarthikSubbarao <[email protected]>
Add SeekForwardPosition API to TextIterator interface and all the derived iterators.
This will help in cases where there is an ordering violation identified based on the initial primed positions of the text iterators. To resolve the ordering violation, we try to seek when possible to avoid repetitive NextPosition calls
Note: It will only ever be used by an search query with an AND Intersection with some proximity property thus requiring a ProximityIterator