Documentation
¶
Index ¶
- type CloudParams
- type DefaultDocumentParser
- type DefaultDocumentWriter
- type DeleteResponse
- type DocumentParser
- type DocumentRaw
- type DocumentWriter
- type FacetField
- type FacetValue
- type Instance
- func (s *Instance) Create(instanceName string) error
- func (s *Instance) Decode(raw []byte, facet bool) (*Response, error)
- func (s *Instance) Delete(instanceName string) error
- func (s *Instance) List() ([]string, error)
- func (s *Instance) Search(params *SearchParams, instanceName string) (*Response, error)
- func (s *Instance) UpdateDocument(instanceName string, postParams map[string]string, payload interface{}) error
- type Response
- type SearchParams
- type SettingsSolrCore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloudParams ¶
type CloudParams struct {
CollectionConfigName string
NumShards int
MaxShardsPerNode int
ReplicationFactor int
AdvancedOptions map[string]string
}
CloudParams - parameters for creating collection
type DefaultDocumentParser ¶
type DefaultDocumentParser struct {
}
DefaultDocumentParser - Default parser
func (*DefaultDocumentParser) Parse ¶
func (p *DefaultDocumentParser) Parse(raw []byte) (interface{}, error)
Parse - parses a document and return a default struct
type DefaultDocumentWriter ¶
type DefaultDocumentWriter struct {
}
DefaultDocumentWriter - default update document writer
func (*DefaultDocumentWriter) Writer ¶
func (u *DefaultDocumentWriter) Writer(payload interface{}) ([]byte, error)
Writer - default document writer
type DeleteResponse ¶
type DeleteResponse struct {
ResponseHeader struct {
Status int `json:"status"`
QTime int `json:"QTime"`
} `json:"responseHeader"`
}
DeleteResponse - response delete
type DocumentParser ¶
type DocumentParser interface {
// Parse - parses the pure document input from JSON
Parse(documents []byte) (interface{}, error)
}
DocumentParser - a generic document parser
type DocumentWriter ¶
type DocumentWriter interface {
// Writer - writes a document
Writer(payload interface{}) ([]byte, error)
}
DocumentWriter - a generic document writer
type FacetField ¶
type FacetField struct {
Name string
List []FacetValue
}
FacetField - struct for facets
type FacetValue ¶
FacetValue - struct for facets name and value
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance The main class to instance solr
func NewCloud ¶
func NewCloud(coreURL string, httpGeTimeout, httpPosTimeout time.Duration, httpGetmaxConn, httpPotmaxConn int, cloudParams *CloudParams, documentParser DocumentParser, documentWriter DocumentWriter) (*Instance, error)
NewCloud - create new cloud instance
func NewCore ¶
func NewCore(coreURL string, httpGeTimeout, httpPosTimeout time.Duration, httpGetmaxConn, httpPotmaxConn int, coreConfig *SettingsSolrCore, documentParser DocumentParser, documentWriter DocumentWriter) *Instance
NewCore Create a new instance core Solr
func (*Instance) Decode ¶
Decode - decode a raw byte from solr instance and return a formated response
func (*Instance) Search ¶
func (s *Instance) Search(params *SearchParams, instanceName string) (*Response, error)
Search A basic search in solr
func (*Instance) UpdateDocument ¶
func (s *Instance) UpdateDocument(instanceName string, postParams map[string]string, payload interface{}) error
UpdateDocument - post json on solr, if the postParams is passed it will be adding in the request. For deleting items you can use the post function using the json format: https://lucene.apache.org/solr/guide/6_6/uploading-data-with-index-handlers.html#UploadingDatawithIndexHandlers-SendingJSONUpdateCommands
type Response ¶
type Response struct {
Status int64 `json:"status,omitempty"`
QTime int64 `json:"Qtime,omitempty"`
NumFound int64 `json:"numFound,omitempty"`
Docs interface{} `json:"Docs,omitempty"`
Facets []FacetField `json:"Facets,omitempty"`
}
Response - response data from solr instance
type SearchParams ¶
type SearchParams struct {
Q string
FL string
FilterQueries []string
BlockJoinFaceting bool
Sort string
Facets map[string]string
Rows int
Start int
}
SearchParams - Params for solr queries
type SettingsSolrCore ¶
type SettingsSolrCore struct {
CoreName string //CoreName - The name of the new core. Same as "name" on the <core> element.
InstanceDir string //InstanceDir - The directory where files for this SolrCore should be stored. Same as instanceDir on the <core> element.
Config string //Config - Name of the config file (i.e., solrconfig.xml) relative to instanceDir
Schema string //Schema - Name of the schema file to use for the core.
DataDir string //DataDir - Name of the data directory relative to instanceDir
}
SettingsSolrCore - Configurations for create a new solr core for more information visit https://lucene.apache.org/solr/guide/6_6/coreadmin-api.html