Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmd/solrgo [test] Add index and select test Aug 31, 2017
doc
example [example] Fix job example Sep 7, 2017
script
solr [test] Add index and select test Aug 31, 2017
.dockerignore [docker] Trigger automated build Aug 23, 2017
.editorconfig
.gitignore
.travis.yml
Dockerfile [docker] Trigger automated build Aug 23, 2017
LICENSE
Makefile [example] Fix job example Sep 7, 2017
README.md [example] Fix job example Sep 7, 2017
glide.lock
glide.yaml [internal] Support passing io.Reader to client Aug 21, 2017

README.md

go-solr

GoDoc Build Status codebeat badge

Solr client in golang

Usage

  • install the cli using go get -u github.com/at15/go-solr/cmd/solrgo, it can create core and index json document
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/at15/go-solr/solr"
)

const coreName = "job"

func main() {
    c := solr.Config{}
    solrClient, err := solr.NewClient(c)
    if err != nil {
        log.Fatal(err)
        return
    }
    if err := solrClient.IsUp(context.Background()); err != nil {
        log.Fatalf("Solr is not up %v", err)
        return
    }
    log.Println("Solr is up")
    solrClient.UseCore(coreName)
    if status, err := solrClient.DefaultCore.Status(context.Background(), false); err != nil {
        log.Fatalf("Check core status failed %v", err)
        return
    } else {
        log.Printf("Got status for core %s %v\n", coreName, status)
    }
}

Features

  • standalone command line util (single binary)
  • query builder
  • auto convert struct to JSON when ingest document

Not implemented

Roadmap

  • using managed schema
    • generate schema xml based on golang struct (w/o?) annotation
    • support schema less
  • query using JSON API
  • v2 API
  • collect metrics about upstream
  • client side load balancing

Alternatives