solr

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBasicAuthHeader

func AddBasicAuthHeader(request *http.Request, solrConfig *SolrConfig)

AddBasicAuthHeader add Auth header with basic auth credentials

func AddNegotiateHeader

func AddNegotiateHeader(request *http.Request, solrConfig *SolrConfig)

AddNegotiateHeader add WWW-Authenticate header (SPNEGO) in case of kerberos is enabled

func GenerateIniFile

func GenerateIniFile(iniFileLocation string)

GenerateIniFile create an ini file to a specific location

func GenerateSolrConfig

func GenerateSolrConfig(iniFileLocation string) (SolrConfig, SSHConfig)

GenerateSolrConfig create sample ini file for Solr data generation

func GenerateSolrData

func GenerateSolrData(solrConfig *SolrConfig, sshConfig *SSHConfig, iniFileLocation string)

GenerateSolrData Use to generate Solr data, also scp keytab file to local if kerberos and ssl config is enabled

func GetSolrCollectionUri

func GetSolrCollectionUri(solrConfig *SolrConfig, uriSuffix string) string

GetSolrCollectionUri gather Solr collection url with url context (if exists) and url suffix e.g.: url - https://myurl:8886, context: /solr, suffix: /update/json/docs = https://myurl:8886/solr/update/json/docs

Types

type BasicAuthConfig

type BasicAuthConfig struct {
	// contains filtered or unexported fields
}

BasicAuthConfig hold authentication credentials

type KerberosConfig

type KerberosConfig struct {
	// contains filtered or unexported fields
}

KerberosConfig holds kerberos related configurations

type SSHConfig

type SSHConfig struct {
	Enabled          bool
	Username         string
	PrivateKeyPath   string
	DownloadLocation string
	RemoteKrb5Conf   string
	RemoteKeytab     string
	Hostname         string
}

SSHConfig holds SSH related configs that is used by the data generator (to gather keytabs if kerberos is enabled)

type SecurityConfig

type SecurityConfig struct {
	// contains filtered or unexported fields
}

SecurityConfig holds security related configurations

func InitSecurityConfig

func InitSecurityConfig(krb5Path string, keytabPath string, principal string, realm string) SecurityConfig

InitSecurityConfig set initial security config on start

type SolrClient

type SolrClient struct {
	// contains filtered or unexported fields
}

SolrClient represents a Solr connection that is used to communicate with Solr HTTP endpoints

func NewSolrClient

func NewSolrClient(solrConfig *SolrConfig) (*SolrClient, error)

NewSolrClient initialize a new Solr client based on configuration type

func (*SolrClient) Query

func (solrClient *SolrClient) Query(solrQuery *SolrQuery) (bool, *SolrResponseData, error)

Query get Solr data based on parameters

func (*SolrClient) Update

func (solrClient *SolrClient) Update(docs interface{}, parameters *url.Values, commit bool) (bool, *SolrResponseData, error)

Update send documents to Solr

type SolrConfig

type SolrConfig struct {
	Url                   string
	Collection            string
	SecurityConfig        *SecurityConfig
	SolrUrlContext        string
	TlsConfig             TLSConfig
	Insecure              bool
	ConnectTimeoutSeconds int
}

SolrConfig holds Solr related configurations

type SolrDataProcessor

type SolrDataProcessor struct {
	Mutex      *sync.Mutex
	SolrClient *SolrClient
}

SolrDataProcessor type for processing Solr data

func (SolrDataProcessor) HandleError

func (p SolrDataProcessor) HandleError(batchContext *processor.BatchContext, err error)

HandleError handle errors during time based buffer processing (it is not used by this generator)

func (SolrDataProcessor) Process

func (p SolrDataProcessor) Process(batchContext *processor.BatchContext) error

Process send gathered data to Solr

type SolrDocument

type SolrDocument map[string]interface{}

SolrDocument represents a Solr document (document map)

type SolrDocuments

type SolrDocuments []SolrDocument

SolrDocuments holds array of Solr documents

type SolrQuery

type SolrQuery struct {
	// contains filtered or unexported fields
}

SolrQuery represents a solr query object

func CreateSolrQuery

func CreateSolrQuery() *SolrQuery

CreateSolrQuery will create a new Solr query with empty queries

func (*SolrQuery) AddFacet

func (q *SolrQuery) AddFacet(field string)

AddFacet add facet field

func (*SolrQuery) AddFields

func (q *SolrQuery) AddFields(fields []string)

AddFields adding fields to Solr query

func (*SolrQuery) AddParam

func (q *SolrQuery) AddParam(key, value string)

AddParam add query parameter for Solr query

func (*SolrQuery) AddPivotFields

func (q *SolrQuery) AddPivotFields(pivotFields []string)

AddPivotFields adding pivot fields to Solr query

func (*SolrQuery) Encode

func (q *SolrQuery) Encode() string

Encode transform Solr query parameters to string

func (*SolrQuery) FacetQuery

func (q *SolrQuery) FacetQuery(query string)

FacetQuery sets facet query string

func (*SolrQuery) FilterQuery

func (q *SolrQuery) FilterQuery(filterQuery string)

FilterQuery add filter query string

func (*SolrQuery) Query

func (q *SolrQuery) Query(query string)

Query sets query string

func (*SolrQuery) Rows

func (q *SolrQuery) Rows(rows int)

Rows sets rows parameter for Solr query

func (*SolrQuery) SetParam

func (q *SolrQuery) SetParam(key, value string)

SetParam set query parameter for Solr query

func (*SolrQuery) Sort

func (q *SolrQuery) Sort(sort string)

Sort sets sort for Solr query

func (*SolrQuery) Start

func (q *SolrQuery) Start(start int)

Start sets start parameter for Solr query

type SolrResponse

type SolrResponse struct {
	NumFound int32          `json:"numFound,omitempty"`
	Start    int32          `json:"start,omitempty"`
	MaxScore float32        `json:"maxScore,omitempty"`
	Docs     []SolrDocument `json:"docs,omitempty"`
}

SolrResponse represents a Solr HTTP response

type SolrResponseData

type SolrResponseData struct {
	ResponseHeader SolrResponseHeader     `json:"responseHeader"`
	Response       SolrResponse           `json:"response"`
	FacetCounts    map[string]interface{} `json:"facet_counts,omitempty"`
	Highlighting   map[string]interface{} `json:"highlighting,omitempty"`
}

SolrResponseData represents Solr response data that contains the response itself and the response header as well

type SolrResponseHeader

type SolrResponseHeader struct {
	Status int32             `json:"status,omitempty"`
	QTime  int32             `json:"QTime,omitempty"`
	Params map[string]string `json:"params,omitempty"`
}

SolrResponseHeader represents Solr request headers from Solr HTTP response

type TLSConfig

type TLSConfig struct {
	// contains filtered or unexported fields
}

TLSConfig holds TLS related configurations

Jump to

Keyboard shortcuts

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