go-solr

solr go client from sendgrid, zookeeper aware, incorporates retries

Github stars Tracking Chart

SendGrid Logo

travis
Go Report Card
GoDoc
MIT licensed
CLA assistant
GitHub contributors

go-solr

solr go client from Sendgrid

Usage

To start the client

solrzk := solr.NewSolrZK(...)
solrzk.Listen()
solrhttp := solr.NewSolrHttp(solrzk)
solrClient := solr.NewSolrHttpRetrier(solrhttp)

The Read and Update methods take a node list use the SolrLocator interface to return a node list

locator := solr.GetSolrLocator(solr.NewSolrZK(...))
type SolrLocator interface {
	GetLeaders(docID string) ([]string, error)
	GetReplicaUris() ([]string, error)
	GetReplicasFromRoute(route string) ([]string, error)
	GetLeadersAndReplicas(docID string) ([]string, error)
}

To make requests

solrClient.Select(locator.GetReplicasFromRoute("shard!"),solr.FilterQuery("myfield:test"),solr.Route("shardkey!"))

To make updates

solrClient.Update(locator.GetLeadersAndReplicas("{anydocidtoroute}"),collectionName,callsSolrJsonDocs, docsMap)

Tests on solr

  1. docker-compose up
  2. docker-compose run gotests bash
  3. go test
  4. go run ./cmd/solrRunner.go 1000

Tests with cluster of 3 solrs

  1. docker-compose -p cluster -f docker-compose.cluster.yml up
  2. docker-compose -p cluster run gotests bash
  3. go test
  4. go run ./cmd/solrRunner.go 1000

License

The MIT License (MIT)

Main metrics

Overview
Name With Ownerstatedecoded/statedecoded
Primary LanguagePHP
Program languageGo (Language Count: 10)
Platform
License:Other
所有者活动
Created At2011-06-12 03:28:21
Pushed At2021-05-12 00:14:49
Last Commit At2017-04-24 12:01:05
Release Count11
Last Release Name1.0 (Posted on )
First Release Namev0.1 (Posted on 2012-05-31 16:29:02)
用户参与
Stargazers Count256
Watchers Count30
Fork Count54
Commits Count1.8k
Has Issues Enabled
Issues Count638
Issue Open Count85
Pull Requests Count85
Pull Requests Open Count4
Pull Requests Close Count8
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private