Class: RSolr::Cloud::Connection
- Inherits:
-
RSolr::Connection
- Object
- RSolr::Connection
- RSolr::Cloud::Connection
- Includes:
- MonitorMixin
- Defined in:
- lib/rsolr/cloud/connection.rb
Overview
RSolr connection adapter for SolrCloud
Constant Summary collapse
- ZNODE_LIVE_NODES =
'/live_nodes'.freeze
- ZNODE_COLLECTIONS =
'/collections'.freeze
Instance Method Summary collapse
- #execute(client, request_context) ⇒ Object
-
#initialize(zk) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(zk) ⇒ Connection
Returns a new instance of Connection.
11 12 13 14 15 16 17 |
# File 'lib/rsolr/cloud/connection.rb', line 11 def initialize(zk) super() @zk = zk init_live_node_watcher init_collections_watcher update_urls end |
Instance Method Details
#execute(client, request_context) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rsolr/cloud/connection.rb', line 19 def execute(client, request_context) collection_name = request_context[:collection] raise 'The :collection option must be specified.' unless collection_name path = request_context[:path].to_s query = request_context[:query] query = query ? "?#{query}" : '' url = select_node(collection_name, path == 'update') raise RSolr::Cloud::Error::NotEnoughNodes unless url request_context[:uri] = RSolr::Uri.create(url).merge(path + query) super(client, request_context) end |