Socket
Socket
Sign inDemoInstall

github.phpd.cn/oleewere/go-solr-client

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.phpd.cn/oleewere/go-solr-client


Version published
Created
Source

Go Solr Client

Build Status Go Report Card license

Install

go get -u github.com/oleewere/solr-client

Usage

import (
	"github.com/oleewere/go-solr-client/solr"
)

func main() {
	securityConfig := SecurityConfig{}
	if kerberosEnabled {
		securityConfig = InitSecurityConfig(krb5Path, keytabPath, principal, realm)
	}
	
	// ...
	
	solrUrl := "http://localhost:8886"
	solrCollection := "mycollection"
	solrConext := "/solr"
	tlsConfig := TLSConfig{}
	
	// ...
	
	solrConfig := SolrConfig{solrUrl, solrCollection, &securityConfig, solrContext,
		tlsConfig, false, solrConnectionTimeout}
	// ...
	
	solrClient, err := NewSolrClient(solrConfig)
	// Create a query - example
	solrQuery := solr.CreateSolrQuery()
	solrQuery.Query("*:*")
	// you can set params one-by-one with solrQuery.AddParam or solrQuery.SetParam etc.
	solrClient.Query(&solrQuery)
	
	// Update docs - example 
	solrDoc1 := make(map[string]interface{})
	solrDoc1["id"] = uuid.NewV4().String()
	// ...
	solrDoc2 := make(map[string]interface{})
	solrDoc2["id"] = uuid.NewV4().String()
	// ...
	solrDocs := make([]interface{}, 0)
	solrDocs = append(solrDocs, solrDoc1)
	solrDocs = append(solrDocs, solrDoc2)
	// ...
	solrClient.Update(solrDocs, nil, true)
}

Developement

make build

Key features

  • Basic auth support
  • Kerberos support

FAQs

Package last updated on 25 Apr 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc