Skip to content
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

Merged
merged 2 commits into from
Jul 11, 2022
Merged

Search api #105

merged 2 commits into from
Jul 11, 2022

Conversation

adilansari
Copy link
Contributor

@adilansari adilansari commented Jul 6, 2022

  • Ability to perform search queries

@adilansari adilansari force-pushed the search-api branch 5 times, most recently from 531b51d to 8169c47 Compare July 8, 2022 15:27
driver/grpc.go Outdated Show resolved Hide resolved
driver/http.go Outdated Show resolved Hide resolved
driver/iterator.go Outdated Show resolved Hide resolved
search/request.go Show resolved Hide resolved
tigris/collection_test.go Outdated Show resolved Hide resolved
api/server/v1/marshaler.go Show resolved Hide resolved
driver/http.go Outdated Show resolved Hide resolved
driver/iterator.go Outdated Show resolved Hide resolved
tigris/iterator.go Outdated Show resolved Hide resolved
search/request.go Show resolved Hide resolved
Page: &req.Page,
PageSize: &req.PageSize,
})
err = HTTPError(err, resp)
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User facing iterator

@adilansari adilansari marked this pull request as ready for review July 11, 2022 15:49
search/request.go Outdated Show resolved Hide resolved
search/request.go Outdated Show resolved Hide resolved
search/request.go Outdated Show resolved Hide resolved
search/request.go Outdated Show resolved Hide resolved
search/request.go Outdated Show resolved Hide resolved
search/response.go Outdated Show resolved Hide resolved
tigris/collection.go Outdated Show resolved Hide resolved
search/response.go Outdated Show resolved Hide resolved
search/response.go Outdated Show resolved Hide resolved
search/request.go Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #105 (ea8ed5e) into main (9719ae2) will increase coverage by 1.19%.
The diff coverage is 86.07%.

@@            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     
Impacted Files Coverage Δ
driver/internal.go 100.00% <ø> (ø)
driver/types.go 0.00% <ø> (ø)
tigris/iterator.go 72.34% <61.90%> (-8.43%) ⬇️
tigris/collection.go 75.00% <73.33%> (-0.61%) ⬇️
driver/iterator.go 58.97% <76.92%> (+8.97%) ⬆️
search/request.go 81.05% <81.05%> (ø)
driver/grpc.go 83.87% <88.88%> (+0.53%) ⬆️
search/response.go 97.67% <97.67%> (ø)
driver/driver.go 91.58% <100.00%> (+0.41%) ⬆️
driver/http.go 76.44% <100.00%> (+2.74%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9719ae2...ea8ed5e. Read the comment docs.

@adilansari adilansari merged commit c28941f into main Jul 11, 2022
@adilansari adilansari deleted the search-api branch July 11, 2022 22:21
@github-actions
Copy link

🎉 This PR is included in version 1.0.0-alpha.20 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version 1.0.0-beta.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented May 9, 2023

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants