Skip to content

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

@alexu84

Description

@alexu84

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)
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions