module Solr

Spatial search: cwiki.apache.org/confluence/display/solr/Spatial+Search

Constants

CURRENT_CORE_CONFIG_VARIABLE_NAME
SOLR_NODE_URL_OVERRIDE_CONFIG
VERSION

Attributes

configuration[RW]

Public Class Methods

configure() { |configuration| ... } click to toggle source
# File lib/solr.rb, line 37
def configure
  yield configuration
  configuration.validate!
  if configuration.zookeeper_url
    enable_solr_cloud!
  elsif configuration.master_url
    enable_master_slave!
  end
  configuration
end
current_core_config() click to toggle source
# File lib/solr.rb, line 48
def current_core_config
  Thread.current[CURRENT_CORE_CONFIG_VARIABLE_NAME] || Solr.configuration.default_core_config
end
instrument(name:, data: {}) { || ... } click to toggle source
# File lib/solr.rb, line 76
def instrument(name:, data: {})
  if defined? ActiveSupport::Notifications
    # Create a copy of data to avoid modifications on the original object by rails
    # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/notifications.rb#L66-L70
    ActiveSupport::Notifications.instrument(name, data.dup) do
      yield if block_given?
    end
  else
    yield if block_given?
  end
end
node_url_override() click to toggle source
# File lib/solr.rb, line 68
def node_url_override
  Thread.current[SOLR_NODE_URL_OVERRIDE_CONFIG]
end
solr_url(path = '') click to toggle source
# File lib/solr.rb, line 72
def solr_url(path = '')
  Solr::Support::UrlHelper.solr_url(path)
end
with_core(core) { || ... } click to toggle source
# File lib/solr.rb, line 52
def with_core(core)
  core_config = Solr.configuration.core_config_by_name(core)
  old_core_config = Thread.current[CURRENT_CORE_CONFIG_VARIABLE_NAME]
  Thread.current[CURRENT_CORE_CONFIG_VARIABLE_NAME] = core_config
  yield
ensure
  Thread.current[CURRENT_CORE_CONFIG_VARIABLE_NAME] = old_core_config
end
with_node_url(url) { || ... } click to toggle source
# File lib/solr.rb, line 61
def with_node_url(url)
  Thread.current[SOLR_NODE_URL_OVERRIDE_CONFIG] = url
  yield
ensure
  Thread.current[SOLR_NODE_URL_OVERRIDE_CONFIG] = nil
end