-
Notifications
You must be signed in to change notification settings - Fork 6
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
Search api #105
Search api #105
Conversation
adilansari
commented
Jul 6, 2022
•
edited
Loading
edited
- Ability to perform search queries
531b51d
to
8169c47
Compare
Page: &req.Page, | ||
PageSize: &req.PageSize, | ||
}) | ||
err = HTTPError(err, resp) |
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.
Error, if any, is attached to stream and will be visible to user when reading stream.
@@ -117,3 +119,53 @@ func (i *eventReadIterator) Close() { | |||
_ = i.close() | |||
i.eof = true | |||
} | |||
|
|||
type SearchResultIterator interface { |
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.
Internal interface, SearchResponse
is still local to Driver
@@ -65,6 +65,17 @@ type DescribeCollectionResponse api.DescribeCollectionResponse | |||
|
|||
type InfoResponse api.GetInfoResponse | |||
|
|||
type SearchRequest struct { |
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.
not a user facing construct, just local to driver
) | ||
|
||
// Request for search | ||
type Request struct { |
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.
User facing construct to prepare a request.
) | ||
|
||
// Result represents response to a search query | ||
type Result[T schema.Model] struct { |
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.
User facing data structure to access search response
|
||
// Search returns Iterator which iterates over matched documents | ||
// in the collection | ||
func (c *Collection[T]) Search(ctx context.Context, req *search.Request) (*SearchIterator[T], 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.
User facing API
func (it *Iterator[T]) Close() { | ||
it.Iterator.Close() | ||
} | ||
|
||
// SearchIterator is used to iterate search documents | ||
type SearchIterator[T interface{}] struct { |
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.
User facing iterator
Codecov Report
@@ Coverage Diff @@
## main #105 +/- ##
==========================================
+ Coverage 79.62% 80.81% +1.19%
==========================================
Files 19 21 +2
Lines 1556 1908 +352
==========================================
+ Hits 1239 1542 +303
- Misses 245 285 +40
- Partials 72 81 +9
Continue to review full report at Codecov.
|
🎉 This PR is included in version 1.0.0-alpha.20 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.0.0-beta.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |