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

Handle cancellations and graceful shutdowns using standard context.Context #57

Open
alexu84 opened this issue Jul 7, 2021 · 0 comments

Comments

@alexu84
Copy link

alexu84 commented Jul 7, 2021

Add support to pass standard context.Context to Search and other functions in order to handle cancellations and graceful shutdowns properly.

Sample use:

package main
import (
        "context"
	"github.com/vanng822/go-solr/solr"
	"fmt"
)

func main() {
  ctx := context.Background()

  si, _ := solr.NewSolrInterfaceWithCtx(ctx, "http://localhost:8983/solr", "collection1")

  query := solr.NewQuery()
  query.Q("*:*")

  s := si.SearchWithCtx(ctx, query)
  r, _ := s.Result(nil)

  fmt.Println(r.Results.Docs)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants