gora

A simple Solr client for Go

  • 所有者: wirelessregistry/gora
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

gora

A simple, bare-bones solr client for Go.

This is a driver in-the-making, and should be approached as such. We appreciate any feedback via issues. Please be harsh and do break our code.

Key features:

  • Uses HTTP connections.
  • Support for facets and standard queries.
  • Support for multiple hosts (SolrCloud) with recovery.

Installation

go get github.com/wirelessregistry/gora

Usage

Gora consists of two layers:

  • A low-level solr client. (see solrclient.go)
  • A connection-management pool. (see workerpool.go)

Low-level client

This is synchronous client, that simply constructs an appropriate JSON post to a given node+core combo. Its input is a SolrJob interface, and it deserializes the resulting JSON as a SolrResponse struct.

The SolrJob interface provides a Bytes() function, which the client uses to obtain the raw query to send to the Solr server. A Handler() function is also provided, giving the job control over how it is processed by Solr.

See solrclient_test.go for usage examples.

Connection Pool

The key inconvenience when using the aforementioned client is concurrent processing and connection management. In detail:

One can launch multiple goroutines (e.g. in the master-slave pattern) to execute queries concurrently. This approach works well when a process does not launch excessive numbers of goroutines. When this does not hold, the connection pool can be launched with a fixed number of running goroutines. In this case, a process submits a job to the pool and awaits the query completion.

A pool can be started with a set of solr hosts (e.g. SolrCloud). In this case, equal number of goroutines will be dedicated to each host. Note that the sharding strategy is not taken into account when assigning jobs to routines. If a host becomes unavailable, the corresponding routines will take themselves offline and wait until the host is again available before taking on new jobs.

主要指标

概览
名称与所有者wirelessregistry/gora
主编程语言Go
编程语言Go (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2016-03-09 15:08:56
推送于2018-02-06 18:43:06
最后一次提交2018-02-06 13:43:00
发布数0
用户参与
星数15
关注者数10
派生数3
提交数26
已启用问题?
问题数1
打开的问题数1
拉请求数3
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?