Sha256: d25039f035c47334d744fc2d520e20cef5bb7f76a2cac306a10264553aa5091d
Contents?: true
Size: 1.93 KB
Versions: 5
Compression:
Stored size: 1.93 KB
Contents
require 'sunspot' require File.join(File.dirname(__FILE__), 'rails', 'configuration') require File.join(File.dirname(__FILE__), 'rails', 'adapters') require File.join(File.dirname(__FILE__), 'rails', 'request_lifecycle') require File.join(File.dirname(__FILE__), 'rails', 'searchable') module Sunspot #:nodoc: module Rails #:nodoc: autoload :StubSessionProxy, File.join(File.dirname(__FILE__), 'rails', 'stub_session_proxy') autoload :Server, File.join(File.dirname(__FILE__), 'rails', 'server') autoload :VERSION, File.join(File.dirname(__FILE__), 'rails', 'version') class <<self attr_writer :configuration def configuration @configuration ||= Sunspot::Rails::Configuration.new end def reset @configuration = nil end def build_session(configuration = self.configuration) if configuration.has_master? SessionProxy::MasterSlaveSessionProxy.new( SessionProxy::ThreadLocalSessionProxy.new(master_config(configuration)), SessionProxy::ThreadLocalSessionProxy.new(slave_config(configuration)) ) else SessionProxy::ThreadLocalSessionProxy.new(slave_config(configuration)) end end private def master_config(sunspot_rails_configuration) config = Sunspot::Configuration.build config.solr.url = URI::HTTP.build( :host => sunspot_rails_configuration.master_hostname, :port => sunspot_rails_configuration.master_port, :path => sunspot_rails_configuration.master_path ).to_s config end def slave_config(sunspot_rails_configuration) config = Sunspot::Configuration.build config.solr.url = URI::HTTP.build( :host => sunspot_rails_configuration.hostname, :port => sunspot_rails_configuration.port, :path => sunspot_rails_configuration.path ).to_s config end end end end
Version data entries
5 entries across 5 versions & 1 rubygems