🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

code.lukou.com/github/go-solr

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code.lukou.com/github/go-solr

v1.0.28
Go
Version published
Created
Source

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

  • docker-compose up
  • docker-compose run gotests bash
  • go test
  • go run ./cmd/solrRunner.go 1000

Tests with cluster of 3 solrs

  • docker-compose -p cluster -f docker-compose.cluster.yml up
  • docker-compose -p cluster run gotests bash
  • go test
  • go run ./cmd/solrRunner.go 1000

License

The MIT License (MIT)

FAQs

Package last updated on 17 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts