Module: Solr::Support::UrlHelper
- Included in:
- Request::Runner
- Defined in:
- lib/solr/support/url_helper.rb
Class Method Summary collapse
- .build_request_url(url:, path:, url_params: {}) ⇒ Object
- .core_url ⇒ Object
- .current_core ⇒ Object
- .solr_cloud_or_master_slave_url ⇒ Object
- .solr_url(path, url_params: {}) ⇒ Object
Class Method Details
.build_request_url(url:, path:, url_params: {}) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/solr/support/url_helper.rb', line 13 def build_request_url(url:, path:, url_params: {}) action_url = File.join(url, path).chomp('/') full_uri = Addressable::URI.parse(action_url) full_uri.query_values = url_params if url_params && url_params.any? full_uri end |
.core_url ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/solr/support/url_helper.rb', line 20 def core_url if Solr.cloud_enabled? || Solr.master_slave_enabled? solr_cloud_or_master_slave_url else current_core.uri end end |
.current_core ⇒ Object
33 34 35 |
# File 'lib/solr/support/url_helper.rb', line 33 def current_core Solr.current_core_config end |
.solr_cloud_or_master_slave_url ⇒ Object
28 29 30 31 |
# File 'lib/solr/support/url_helper.rb', line 28 def solr_cloud_or_master_slave_url url = Solr.active_nodes_for(collection: current_core.name.to_s).first File.join(url, current_core.name.to_s) end |
.solr_url(path, url_params: {}) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/solr/support/url_helper.rb', line 6 def solr_url(path, url_params: {}) full_url = File.join(core_url, path) full_uri = Addressable::URI.parse(full_url) full_uri.query_values = url_params if url_params.any? full_uri end |