Documentation ¶
Overview ¶
Solr client in Go, core admin, add docs, update, delete, search and more
package main import ( "github.com/vanng822/go-solr/solr" "fmt" ) func main() { si, _ := solr.NewSolrInterface("http://localhost:8983/solr", "collection1") query := solr.NewQuery() query.Q("*:*") s := si.Search(query) r, _ := s.Result(nil) fmt.Println(r.Results.Docs) }
Index ¶
- Constants
- Variables
- func HTTPGet(url string, headers [][]string, username, password string, ...) ([]byte, error)
- func HTTPPost(path string, data *[]byte, headers [][]string, username, password string, ...) ([]byte, error)
- func ParseDocResponse(docResponse map[string]interface{}, collection *Collection)
- type Collection
- type Connection
- func (c *Connection) AddHeader(key, value string)
- func (c *Connection) Resource(source string, params *url.Values) (*[]byte, error)
- func (c *Connection) SetBasicAuth(username, password string)
- func (c *Connection) SetCore(core string)
- func (c *Connection) SetTimeout(timeout time.Duration)
- func (c *Connection) Update(data interface{}, params *url.Values) (*SolrUpdateResponse, error)
- type CoreAdmin
- func (ca *CoreAdmin) Action(action string, params *url.Values) (*SolrResponse, error)
- func (ca *CoreAdmin) Get(path string, params *url.Values) (*SolrResponse, error)
- func (ca *CoreAdmin) Reload(core string) (*SolrResponse, error)
- func (ca *CoreAdmin) Rename(core, other string) (*SolrResponse, error)
- func (ca *CoreAdmin) SetBasicAuth(username, password string)
- func (ca *CoreAdmin) Split(core string, targetCore ...string) (*SolrResponse, error)
- func (ca *CoreAdmin) Status(core string) (*SolrResponse, error)
- func (ca *CoreAdmin) Swap(core, other string) (*SolrResponse, error)
- func (ca *CoreAdmin) Unload(core string) (*SolrResponse, error)
- type Document
- type ExtensiveResultParser
- func (parser *ExtensiveResultParser) Parse(resp_ *[]byte) (*SolrResult, error)
- func (parser *ExtensiveResultParser) ParseError(response *SolrResponse, sr *SolrResult)
- func (parser *ExtensiveResultParser) ParseFacets(response *SolrResponse, sr *SolrResult)
- func (parser *ExtensiveResultParser) ParseJsonFacets(response *SolrResponse, sr *SolrResult)
- func (parser *ExtensiveResultParser) ParseResponse(response *SolrResponse, sr *SolrResult) (err error)
- func (parser *ExtensiveResultParser) ParseResponseHeader(response *SolrResponse, sr *SolrResult)
- type FireworkCollection
- type FireworkResultParser
- type FireworkSolrResult
- type M
- type MltResultParser
- type MoreLikeThisParser
- type Query
- func (q *Query) AddFacet(f string)
- func (q *Query) AddFacetPivot(f string)
- func (q *Query) AddFacetQuery(fq string)
- func (q *Query) AddJsonFacet(jf string)
- func (q *Query) AddParam(k, v string)
- func (q *Query) BoostFunctions(bf string)
- func (q *Query) BoostQuery(bq string)
- func (q *Query) DefType(defType string)
- func (q *Query) FieldList(fl string)
- func (q *Query) FilterQuery(fq string)
- func (q *Query) Geofilt(latitude, longitude float64, sfield string, distance float64)
- func (q *Query) GetParam(k string) string
- func (qq *Query) Q(q string)
- func (q *Query) QueryFields(qf string)
- func (q *Query) RemoveParam(k string)
- func (q *Query) Rows(rows int)
- func (q *Query) SetFacetMinCount(mc int)
- func (q *Query) SetFacetPivotMinCount(mc int)
- func (q *Query) SetParam(k, v string)
- func (q *Query) Sort(sort string)
- func (q *Query) Start(start int)
- func (q *Query) String() string
- type RealTimeGetParser
- type RealTimeGetResultParser
- type ResultParser
- type Schema
- func (s *Schema) All() (*SolrResponse, error)
- func (s *Schema) DynamicFields(fl string, showDefaults bool) (*SolrResponse, error)
- func (s *Schema) DynamicFieldsName(name string, showDefaults bool) (*SolrResponse, error)
- func (s *Schema) Fields(fl string, includeDynamic, showDefaults bool) (*SolrResponse, error)
- func (s *Schema) FieldsName(name string, includeDynamic, showDefaults bool) (*SolrResponse, error)
- func (s *Schema) Fieldtypes(showDefaults bool) (*SolrResponse, error)
- func (s *Schema) FieldtypesName(name string, showDefaults bool) (*SolrResponse, error)
- func (s *Schema) Get(path string, params *url.Values) (*SolrResponse, error)
- func (s *Schema) Name() (*SolrResponse, error)
- func (s *Schema) Post(path string, data interface{}) (*SolrUpdateResponse, error)
- func (s *Schema) SetBasicAuth(username, password string)
- func (s *Schema) SetCore(core string)
- func (s *Schema) Uniquekey() (*SolrResponse, error)
- func (s *Schema) Version() (*SolrResponse, error)
- type Search
- func (s *Search) MoreLikeThis(parser MltResultParser) (*SolrMltResult, error)
- func (s *Search) QueryParams() *url.Values
- func (s *Search) QueryString() string
- func (s *Search) RealTimeGet(parser RealTimeGetResultParser) (*SolrRealtimeGetResult, error)
- func (s *Search) Resource(resource string, params *url.Values) (*[]byte, error)
- func (s *Search) Result(parser ResultParser) (*SolrResult, error)
- func (s *Search) SetQuery(q *Query)
- func (s *Search) SpellCheck(parser ResultParser) (*SolrResult, error)
- type SolrInterface
- func (si *SolrInterface) Add(docs []Document, chunk_size int, params *url.Values) (*SolrUpdateResponse, error)
- func (si *SolrInterface) Commit() (*SolrUpdateResponse, error)
- func (si *SolrInterface) CoreAdmin() (*CoreAdmin, error)
- func (si *SolrInterface) Delete(data map[string]interface{}, params *url.Values) (*SolrUpdateResponse, error)
- func (si *SolrInterface) DeleteAll() (*SolrUpdateResponse, error)
- func (si *SolrInterface) Optimize(params *url.Values) (*SolrUpdateResponse, error)
- func (si *SolrInterface) Ping() (status string, qtime int, err error)
- func (si *SolrInterface) Rollback() (*SolrUpdateResponse, error)
- func (si *SolrInterface) Schema() (*Schema, error)
- func (si *SolrInterface) Search(q *Query) *Search
- func (si *SolrInterface) SetBasicAuth(username, password string)
- func (si *SolrInterface) SetCore(core string)
- func (si *SolrInterface) SetTimeout(timeout time.Duration)
- func (si *SolrInterface) SoftCommit() (*SolrUpdateResponse, error)
- func (si *SolrInterface) Update(data interface{}, params *url.Values) (*SolrUpdateResponse, error)
- type SolrMltResult
- type SolrRealtimeGetResult
- type SolrResponse
- type SolrResult
- type SolrUpdateResponse
- type StandardResultParser
- func (parser *StandardResultParser) Parse(resp_ *[]byte) (*SolrResult, error)
- func (parser *StandardResultParser) ParseError(response *SolrResponse, sr *SolrResult)
- func (parser *StandardResultParser) ParseFacetCounts(response *SolrResponse, sr *SolrResult)
- func (parser *StandardResultParser) ParseHighlighting(response *SolrResponse, sr *SolrResult)
- func (parser *StandardResultParser) ParseMoreLikeThis(response *SolrResponse, sr *SolrResult)
- func (parser *StandardResultParser) ParseResponse(response *SolrResponse, sr *SolrResult) (err error)
- func (parser *StandardResultParser) ParseResponseHeader(response *SolrResponse, sr *SolrResult)
- func (parser *StandardResultParser) ParseSpellCheck(response *SolrResponse, sr *SolrResult)
- func (parser *StandardResultParser) ParseStats(response *SolrResponse, sr *SolrResult)
Constants ¶
const (
VERSION = "0.7"
)
Variables ¶
var MaximumSolrUrlLengthSupported = 2083
Solr imposes a limit on the size of a URL send to it using GET requests. Thus this library will switch to use to POST requests as the user query's grow up. If you need, you can charge this value, but be aware of the URL limit in your Solr distribution.
Functions ¶
func HTTPGet ¶
func HTTPGet(url string, headers [][]string, username, password string, timeout time.Duration) ([]byte, error)
HTTPGet make a GET request to url, headers and timeout are optional
func HTTPPost ¶
func HTTPPost(path string, data *[]byte, headers [][]string, username, password string, timeout time.Duration) ([]byte, error)
HTTPPost make a POST request to path which also includes domain, headers and timeout are optional
func ParseDocResponse ¶
func ParseDocResponse(docResponse map[string]interface{}, collection *Collection)
Types ¶
type Collection ¶
Holding the search result
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(solrUrl, core string) (*Connection, error)
NewConnection will parse solrUrl and return a connection object, solrUrl must be a absolute url or path
func (*Connection) AddHeader ¶
func (c *Connection) AddHeader(key, value string)
func (*Connection) SetBasicAuth ¶
func (c *Connection) SetBasicAuth(username, password string)
func (*Connection) SetTimeout ¶
func (c *Connection) SetTimeout(timeout time.Duration)
func (*Connection) Update ¶
func (c *Connection) Update(data interface{}, params *url.Values) (*SolrUpdateResponse, error)
Update take optional params which can use to specify addition parameters such as commit=true
type CoreAdmin ¶
type CoreAdmin struct {
// contains filtered or unexported fields
}
func NewCoreAdmin ¶
solrUrl should look like this http://0.0.0.0:8983/solr[/admin/cores] ie /admin/cores will append automatically when calling Action
func (*CoreAdmin) Action ¶
Call to admin/cores endpoint, additional params neccessary for this action can specified in params. No check is done for those params so check https://wiki.apache.org/solr/CoreAdmin for detail
func (*CoreAdmin) Get ¶
Method for making GET-request to any relitive path to /admin/ such as /admin/cores or /admin/info/threads
func (*CoreAdmin) Reload ¶
func (ca *CoreAdmin) Reload(core string) (*SolrResponse, error)
Reload a core, see https://wiki.apache.org/solr/CoreAdmin#RELOAD
func (*CoreAdmin) Rename ¶
func (ca *CoreAdmin) Rename(core, other string) (*SolrResponse, error)
Rename a core See https://wiki.apache.org/solr/CoreAdmin#RENAME
func (*CoreAdmin) SetBasicAuth ¶
Set basic auth in case solr require login
func (*CoreAdmin) Split ¶
func (ca *CoreAdmin) Split(core string, targetCore ...string) (*SolrResponse, error)
Splits an index into two or more indexes See https://wiki.apache.org/solr/CoreAdmin#SPLIT Only targetCore is supported here. If you want to use "path" use Action method. Available in Solr4.3
func (*CoreAdmin) Status ¶
func (ca *CoreAdmin) Status(core string) (*SolrResponse, error)
pass empty string as core if you want status of all cores. See https://wiki.apache.org/solr/CoreAdmin#STATUS
func (*CoreAdmin) Swap ¶
func (ca *CoreAdmin) Swap(core, other string) (*SolrResponse, error)
Swap one core with other core. See https://wiki.apache.org/solr/CoreAdmin#SWAP
func (*CoreAdmin) Unload ¶
func (ca *CoreAdmin) Unload(core string) (*SolrResponse, error)
Unload a core, see https://wiki.apache.org/solr/CoreAdmin#UNLOAD If you want to use those flag deleteIndex, deleteDataDir, deleteInstanceDir Please use Action-method with those params specified, like ca.Action("UNLOAD", params)
type ExtensiveResultParser ¶
type ExtensiveResultParser struct { }
func (*ExtensiveResultParser) Parse ¶
func (parser *ExtensiveResultParser) Parse(resp_ *[]byte) (*SolrResult, error)
func (*ExtensiveResultParser) ParseError ¶
func (parser *ExtensiveResultParser) ParseError(response *SolrResponse, sr *SolrResult)
func (*ExtensiveResultParser) ParseFacets ¶
func (parser *ExtensiveResultParser) ParseFacets(response *SolrResponse, sr *SolrResult)
ParseJsonFacets will assign facets and build sr.jsonfacets if there is a facet_counts
func (*ExtensiveResultParser) ParseJsonFacets ¶
func (parser *ExtensiveResultParser) ParseJsonFacets(response *SolrResponse, sr *SolrResult)
ParseJsonFacets will assign facets and build sr.jsonfacets if there is a facets
func (*ExtensiveResultParser) ParseResponse ¶
func (parser *ExtensiveResultParser) ParseResponse(response *SolrResponse, sr *SolrResult) (err error)
ParseSolrResponse will assign result and build sr.docs if there is a response. If there is no response or grouped property in response it will return error
func (*ExtensiveResultParser) ParseResponseHeader ¶
func (parser *ExtensiveResultParser) ParseResponseHeader(response *SolrResponse, sr *SolrResult)
type FireworkCollection ¶
type FireworkCollection struct { Docs *json.RawMessage Start int NumFound int }
Holding the search result
type FireworkResultParser ¶
type FireworkResultParser struct { }
func (*FireworkResultParser) Parse ¶
func (parser *FireworkResultParser) Parse(resp *[]byte) (FireworkSolrResult, error)
type FireworkSolrResult ¶
type FireworkSolrResult struct { Status int // status quick access to status Results FireworkCollection `json:"response"` // results parsed documents, basically response object QTime int Params map[string]string `json:"params"` ResponseHeader map[string]interface{} FacetCounts map[string]interface{} Highlighting map[string]interface{} Error map[string]interface{} Grouped map[string]interface{} // grouped for grouping result if grouping Results will be empty Stats map[string]interface{} MoreLikeThis map[string]interface{} // MoreLikeThis using Search (select) Component NextCursorMark string `json:"nextCursorMark"` }
Parsed result for SearchHandler response, ie /select
type MltResultParser ¶
type MltResultParser interface {
Parse(*[]byte) (*SolrMltResult, error)
}
type MoreLikeThisParser ¶
type MoreLikeThisParser struct { }
func (*MoreLikeThisParser) Parse ¶
func (parser *MoreLikeThisParser) Parse(resp_ *[]byte) (*SolrMltResult, error)
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) AddFacet ¶
f (Facet) https://cwiki.apache.org/confluence/display/solr/Faceting#Faceting-Thefacet.fieldParameter Example: category
func (*Query) AddFacetPivot ¶
f (Facet) https://wiki.apache.org/solr/SimpleFacetParameters#facet.pivot Example: category
func (*Query) AddFacetQuery ¶
fq (FacetQuery) https://wiki.apache.org/solr/SimpleFacetParameters#facet.query_:_Arbitrary_Query_Faceting Example: price:[* TO 500]
func (*Query) AddJsonFacet ¶
jf (Json facet) https://cwiki.apache.org/confluence/display/solr/JSON+Request+API#JSONRequestAPI-FacetExample Example: {avg_price:"avg(price)"}
func (*Query) BoostFunctions ¶
bf (Boost Functions) parameter http://wiki.apache.org/solr/DisMaxQParserPlugin Example: ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3 Check this http://wiki.apache.org/solr/FunctionQuery for available functions
func (*Query) BoostQuery ¶
bq (Boost Query) parameter http://wiki.apache.org/solr/DisMaxQParserPlugin
func (*Query) DefType ¶
defType http://wiki.apache.org/solr/CommonQueryParameters Example: dismax
func (*Query) FieldList ¶
fl (Field List ) parameter http://wiki.apache.org/solr/CommonQueryParameters Example: id,name,decsription
func (*Query) FilterQuery ¶
fq (Filter Query) http://wiki.apache.org/solr/CommonQueryParameters Example: popularity:[10 TO *]
func (*Query) Geofilt ¶
geofilt - The distance filter http://wiki.apache.org/solr/SpatialSearch Output example: fq={!geofilt pt=45.15,-93.85 sfield=store d=5}
func (*Query) Q ¶
q parameter http://wiki.apache.org/solr/CommonQueryParameters Example: id:100
func (*Query) QueryFields ¶
qf (Query Fields) parameter http://wiki.apache.org/solr/DisMaxQParserPlugin Example: features^20.0+text^0.3
func (*Query) RemoveParam ¶
func (*Query) SetFacetMinCount ¶
mc (Facet min count) https://cwiki.apache.org/confluence/display/solr/Faceting#Faceting-Thefacet.mincountParameter Example: 5
func (*Query) SetFacetPivotMinCount ¶
mc (Facet pivot min count) https://wiki.apache.org/solr/SimpleFacetParameters#facet.pivot Example: 5
func (*Query) Sort ¶
sort parameter http://wiki.apache.org/solr/CommonQueryParameters Example: geodist() asc
type RealTimeGetParser ¶
type RealTimeGetParser struct { }
func (*RealTimeGetParser) Parse ¶
func (parser *RealTimeGetParser) Parse(resp_ *[]byte) (*SolrRealtimeGetResult, error)
Parse function for RealTimeGetParser
type RealTimeGetResultParser ¶
type RealTimeGetResultParser interface {
Parse(*[]byte) (*SolrRealtimeGetResult, error)
}
type ResultParser ¶
type ResultParser interface {
Parse(resp *[]byte) (*SolrResult, error)
}
ResultParser is interface for parsing result from response. The idea here is that application have possibility to parse. Or defined own parser with internal data structure to suite application's need
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
func NewSchema ¶
NewSchema will parse solrUrl and return a schema object, solrUrl must be a absolute url or path
func (*Schema) All ¶
func (s *Schema) All() (*SolrResponse, error)
Return entire schema, require Solr4.3, see https://wiki.apache.org/solr/SchemaRESTAPI
func (*Schema) DynamicFields ¶
func (s *Schema) DynamicFields(fl string, showDefaults bool) (*SolrResponse, error)
func (*Schema) DynamicFieldsName ¶
func (s *Schema) DynamicFieldsName(name string, showDefaults bool) (*SolrResponse, error)
func (*Schema) Fields ¶
func (s *Schema) Fields(fl string, includeDynamic, showDefaults bool) (*SolrResponse, error)
func (*Schema) FieldsName ¶
func (s *Schema) FieldsName(name string, includeDynamic, showDefaults bool) (*SolrResponse, error)
func (*Schema) Fieldtypes ¶
func (s *Schema) Fieldtypes(showDefaults bool) (*SolrResponse, error)
func (*Schema) FieldtypesName ¶
func (s *Schema) FieldtypesName(name string, showDefaults bool) (*SolrResponse, error)
func (*Schema) Get ¶
See Get requests in https://wiki.apache.org/solr/SchemaRESTAPI for detail
func (*Schema) Name ¶
func (s *Schema) Name() (*SolrResponse, error)
Return name of schema, require Solr4.3, see https://wiki.apache.org/solr/SchemaRESTAPI
func (*Schema) Post ¶
func (s *Schema) Post(path string, data interface{}) (*SolrUpdateResponse, error)
For modify schema, require Solr4.4, currently one can add fields and copy fields. Example: s.Post("fields", data) for adding new fields. See https://wiki.apache.org/solr/SchemaRESTAPI
func (*Schema) SetBasicAuth ¶
func (*Schema) Uniquekey ¶
func (s *Schema) Uniquekey() (*SolrResponse, error)
Require Solr4.3, see https://wiki.apache.org/solr/SchemaRESTAPI
func (*Schema) Version ¶
func (s *Schema) Version() (*SolrResponse, error)
Require Solr4.3, see https://wiki.apache.org/solr/SchemaRESTAPI
type Search ¶
type Search struct { Debug string // contains filtered or unexported fields }
func NewSearch ¶
func NewSearch(c *Connection, q *Query) *Search
NewSearch takes c and q as optional
func (*Search) MoreLikeThis ¶
func (s *Search) MoreLikeThis(parser MltResultParser) (*SolrMltResult, error)
This method is for making query to MoreLikeThisHandler See http://wiki.apache.org/solr/MoreLikeThisHandler
func (*Search) QueryParams ¶
Return query params including debug and indent if Debug is set
func (*Search) QueryString ¶
QueryString return a query string of all queries except wt=json
func (*Search) RealTimeGet ¶
func (s *Search) RealTimeGet(parser RealTimeGetResultParser) (*SolrRealtimeGetResult, error)
RealTimeGet makes queries to the RealTimeGetHandler See https://lucene.apache.org/solr/guide/8_0/realtime-get.html This currently supports only the id (unique-key) and fq parameters Regardless of what actual name the unique-key field has, it should be specified as id or ids in the params
func (*Search) Resource ¶
Wrapper for connection.Resource which will add wt=json automatically One can use this to query to /solr/{CORE}/{RESOURCE} example /solr/collection1/select This can be useful when you use an search component that is not supported in this package
func (*Search) Result ¶
func (s *Search) Result(parser ResultParser) (*SolrResult, error)
Result will create a StandardResultParser if no parser specified. parser must be an implementation of ResultParser interface
func (*Search) SpellCheck ¶
func (s *Search) SpellCheck(parser ResultParser) (*SolrResult, error)
This method is for making query to SpellCheckHandler See https://wiki.apache.org/solr/SpellCheckComponent
type SolrInterface ¶
type SolrInterface struct {
// contains filtered or unexported fields
}
func NewSolrInterface ¶
func NewSolrInterface(solrUrl, core string) (*SolrInterface, error)
Return a new instance of SolrInterface
func (*SolrInterface) Add ¶
func (si *SolrInterface) Add(docs []Document, chunk_size int, params *url.Values) (*SolrUpdateResponse, error)
Add will insert documents in batch of chunk_size. success is false as long as one chunk failed. The result in SolrUpdateResponse is summery of response from all chunks with key chunk_%d
func (*SolrInterface) Commit ¶
func (si *SolrInterface) Commit() (*SolrUpdateResponse, error)
Commit the changes since the last commit
func (*SolrInterface) CoreAdmin ¶
func (si *SolrInterface) CoreAdmin() (*CoreAdmin, error)
Return new instance of CoreAdmin with provided solrUrl and basic auth
func (*SolrInterface) Delete ¶
func (si *SolrInterface) Delete(data map[string]interface{}, params *url.Values) (*SolrUpdateResponse, error)
Delete take data of type map and optional params which can use to specify addition parameters such as commit=true . Only one delete statement is supported, ie data can be { "id":"ID" } . If you want to delete more docs use { "query":"QUERY" } . Extra params can specify in params or in data such as { "query":"QUERY", "commitWithin":"500" }
func (*SolrInterface) DeleteAll ¶
func (si *SolrInterface) DeleteAll() (*SolrUpdateResponse, error)
DeleteAll will remove all documents and commit
func (*SolrInterface) Optimize ¶
func (si *SolrInterface) Optimize(params *url.Values) (*SolrUpdateResponse, error)
func (*SolrInterface) Ping ¶
func (si *SolrInterface) Ping() (status string, qtime int, err error)
Return 'status' and QTime from solr, if everything is fine status should have value 'OK' QTime will have value -1 if can not determine
func (*SolrInterface) Rollback ¶
func (si *SolrInterface) Rollback() (*SolrUpdateResponse, error)
Rollback rollbacks all add/deletes made to the index since the last commit. This should use with caution. See https://wiki.apache.org/solr/UpdateXmlMessages#A.22rollback.22
func (*SolrInterface) Schema ¶
func (si *SolrInterface) Schema() (*Schema, error)
Return new instance of Schema with provided solrUrl and basic auth
func (*SolrInterface) Search ¶
func (si *SolrInterface) Search(q *Query) *Search
Return a new instace of Search, q is optional and one can set it later
func (*SolrInterface) SetBasicAuth ¶
func (si *SolrInterface) SetBasicAuth(username, password string)
SetBasicAuth sets the request's Authorization header to use HTTP Basic Authentication with the provided username and password. See http://golang.org/pkg/net/http/#Request.SetBasicAuth
func (*SolrInterface) SetCore ¶
func (si *SolrInterface) SetCore(core string)
Set to new core, this is just wrapper to Connection.SetCore which mean it will affect all places that use this Connection instance
func (*SolrInterface) SetTimeout ¶
func (si *SolrInterface) SetTimeout(timeout time.Duration)
Set timeout for non admin/schema requests, this is just wrapper to Connection.SetTimeout which mean it will affect all places that use this Connection instance
func (*SolrInterface) SoftCommit ¶
func (si *SolrInterface) SoftCommit() (*SolrUpdateResponse, error)
Soft commit the changes since the last commit see https://lucene.apache.org/solr/guide/8_0/updatehandlers-in-solrconfig.html
func (*SolrInterface) Update ¶
func (si *SolrInterface) Update(data interface{}, params *url.Values) (*SolrUpdateResponse, error)
Update take data of type interface{} and optional params which can use to specify addition parameters such as commit=true
type SolrMltResult ¶
type SolrMltResult struct { Status int // status quick access to status Results *Collection // results parsed documents, basically response object Match *Collection // Documents for match section ResponseHeader map[string]interface{} Error map[string]interface{} }
Parsed result for MoreLikeThisHandler response, ie /mlt
type SolrRealtimeGetResult ¶
type SolrRealtimeGetResult struct {
Results *Collection
}
SolrRealtimeGetResult is the parsed result for the RealTimeGetHandler response ie /get
type SolrResponse ¶
type SolrResult ¶
type SolrResult struct { Status int // status quick access to status Results *Collection // results parsed documents, basically response object QTime int ResponseHeader map[string]interface{} Facets map[string]interface{} JsonFacets map[string]interface{} FacetCounts map[string]interface{} Highlighting map[string]interface{} Error map[string]interface{} Grouped map[string]interface{} // grouped for grouping result if grouping Results will be empty Stats map[string]interface{} MoreLikeThis map[string]interface{} // MoreLikeThis using Search (select) Component SpellCheck map[string]interface{} // SpellCheck using SpellCheck (spell) Component NextCursorMark string }
Parsed result for SearchHandler response, ie /select
type SolrUpdateResponse ¶
type StandardResultParser ¶
type StandardResultParser struct { }
func (*StandardResultParser) Parse ¶
func (parser *StandardResultParser) Parse(resp_ *[]byte) (*SolrResult, error)
func (*StandardResultParser) ParseError ¶
func (parser *StandardResultParser) ParseError(response *SolrResponse, sr *SolrResult)
func (*StandardResultParser) ParseFacetCounts ¶
func (parser *StandardResultParser) ParseFacetCounts(response *SolrResponse, sr *SolrResult)
ParseFacetCounts will assign facet_counts to sr if there is one. No modification done here
func (*StandardResultParser) ParseHighlighting ¶
func (parser *StandardResultParser) ParseHighlighting(response *SolrResponse, sr *SolrResult)
ParseHighlighting will assign highlighting to sr if there is one. No modification done here
func (*StandardResultParser) ParseMoreLikeThis ¶
func (parser *StandardResultParser) ParseMoreLikeThis(response *SolrResponse, sr *SolrResult)
Parse moreLikeThis if there is in response
func (*StandardResultParser) ParseResponse ¶
func (parser *StandardResultParser) ParseResponse(response *SolrResponse, sr *SolrResult) (err error)
ParseSolrResponse will assign result and build sr.docs if there is a response. If there is no response or grouped property in response it will return error
func (*StandardResultParser) ParseResponseHeader ¶
func (parser *StandardResultParser) ParseResponseHeader(response *SolrResponse, sr *SolrResult)
func (*StandardResultParser) ParseSpellCheck ¶
func (parser *StandardResultParser) ParseSpellCheck(response *SolrResponse, sr *SolrResult)
Parse moreLikeThis if there is in response
func (*StandardResultParser) ParseStats ¶
func (parser *StandardResultParser) ParseStats(response *SolrResponse, sr *SolrResult)
Parse stats if there is in response