go-solr

module
v0.0.0-...-4246479 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2017 License: MIT

README

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

Directories

Path Synopsis
cmd
example
job
internal
Package internal wraps http.Client to do json encoding/decoding automatically and add default query parameters (i.e.
Package internal wraps http.Client to do json encoding/decoding automatically and add default query parameters (i.e.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL