-
Notifications
You must be signed in to change notification settings - Fork 367
Tolerate existing paging control in SearchWithPaging #51
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
@@ -268,6 +268,9 @@ func NewSearchRequest( | |||
} | |||
} | |||
|
|||
// SearchWithPaging augments the given search request with a paging control containing the given paging size, then | |||
// issues a search with buffered paging using the request. All paged responses are buffered so that the result can | |||
// be returned atomically. | |||
func (l *Conn) SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32) (*SearchResult, error) { |
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.
This function is really doing two things:
- adding the paging control (which is easy to do yourself, and depending on the calling code, you might want to do yourself. I'd even consider requiring it in a future major version and removing the pagingSize param from here... not a huge fan of mutating the SearchRequest inside the function)
- searching/paging/appending (which is hard to do yourself)
What if we made SearchWithPaging
tolerate a searchRequest
that already had a matching ControlTypePaging
control? That would let us avoid expanding the interface surface area
cases:
ControlTypePaging
control missing, adds one matching pagingSize (current behavior)ControlTypePaging
control present but not actually a*ControlPaging
, returns errorControlTypePaging
control present and matching pagingSize, no-op (would enable your use case)ControlTypePaging
control present but not matching pagingSize, returns error
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 I pass through in the third case? SearchWithPaging(mySearchRequest, someIgnoredInt)
?
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.
you'd pass a pageSize that matched the already-present control's PagedSize
803d130
to
907411e
Compare
907411e
to
2edeca7
Compare
@liggitt Changed |
LGTM. @johnweldon, any feedback on tolerating an already-present paging control like this? |
Looks like a nice improvement, and low risk. LGTM |
Tolerate existing paging control in SearchWithPaging
With the current implementation of
Search
, our interaction with this library has been as such:SearchRequest
SearchResponse
The current API for
SearchWithPaging
does not honor this workflow and expects something other than a fully-qualifiedSearchRequest
to function. This PR adds another API call that allows for a fully qualified search request to be all that is necessary to issue a request to search with client-side page stitching.@johnweldon @liggitt PTAL