MB-67212: Supporting search_after/search_before for deep pagination over non textual content - #2208
Conversation
…in TopNCollector - Introduced new test cases for searching after numeric, datetime, and geo fields. - Implemented encoding for pagination on these fields to enhance search capabilities. - Updated the createSearchAfterDocument function to support encoded sort values. - Ensured proper handling of search results in the new test cases. This enhances the search functionality by allowing users to paginate through results based on specific criteria.
…nd geo fields - Added a new function `validatePagination` to check the validity of `SearchAfter` and `SearchBefore` values based on the sort order. - Introduced comprehensive test cases to validate pagination behavior for various field types. - Updated the `SearchRequest.Validate` method to incorporate pagination validation. - Adjusted the handling of encoded sort values in the `TopNCollector` for improved search functionality.
abhinavdangeti
left a comment
There was a problem hiding this comment.
@capemox would we not need to extend support for search_before as well or do both paths have overlap?
In a separate follow up PR, would you add a docs/pagination.md following similar syntax to the others in docs/ showcasing how users can use the traditional pagination and how they can use search_after/search_before for better performance during deep pagination.
| } | ||
|
|
||
| // Creates a dummy document to compare with for pagination. | ||
| func createSearchAfterDocument(sort search.SortOrder, after []string) *search.DocumentMatch { |
There was a problem hiding this comment.
I forget this, but are there no such utilities for searchBefore?
There was a problem hiding this comment.
Internally, SearchBefore is converted to a SearchAfter problem by reversing the sort order, so we don't need to handle both cases separately
Lines 584 to 589 in 487fa5f
abhinavdangeti
left a comment
There was a problem hiding this comment.
Great work @capemox ! Feel free to merge away.
…ver non textual content (#2208) Add search after functionality for numeric, datetime, and geo fields in TopNCollector - Introduced new test cases for searching after numeric, datetime, and geo fields. - Implemented encoding for pagination on these fields to enhance search capabilities. - Updated the createSearchAfterDocument function to support encoded sort values. - Ensured proper handling of search results in the new test cases. This enhances the search functionality by allowing users to paginate through results based on specific criteria.
Add search after functionality for numeric, datetime, and geo fields in TopNCollector
This enhances the search functionality by allowing users to paginate through results based on specific criteria.