GithubHelp home page GithubHelp logo

microsoftly / go-solr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anuccio1/go-solr

0.0 2.0 1.0 3.57 MB

solr go client from sendgrid, zookeeper aware, incorporates retries

License: MIT License

Go 90.86% Shell 3.22% Java 5.67% Makefile 0.01% Dockerfile 0.24%

go-solr's Introduction

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)

go-solr's People

Contributors

bculberson avatar cswank avatar inyee786 avatar pushkyn avatar shawnfeldman avatar strum355 avatar tariq1890 avatar thepriefy avatar vaskoz avatar

Watchers

 avatar  avatar

Forkers

jagonalez

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.