Sha256: 7409fefd7558791643c9adae17f91ec23c59a432918e3a142a650a568ab1f58d

Contents?: true

Size: 1.67 KB

Versions: 2

Compression:

Stored size: 1.67 KB

Contents

module Sunspot
  module Rails
    class Server < Sunspot::Solr::Server

      # 
      # Directory in which to store PID files
      #
      def pid_dir
        configuration.pid_dir || File.join(::Rails.root, 'tmp', 'pids')
      end

      # 
      # Name of the PID file
      #
      def pid_file
        "sunspot-solr-#{::Rails.env}.pid"
      end

      # 
      # Directory to use for Solr home.
      #
      def solr_home
        File.join(configuration.solr_home)
      end

      #
      # Solr start jar
      #
      def solr_executable
        configuration.solr_executable || super
      end

      # 
      # Address on which to run Solr
      #
      def bind_address
        configuration.bind_address
      end

      # 
      # Port on which to run Solr
      #
      def port
        configuration.port
      end

      def log_level
        configuration.log_level
      end

      # 
      # Log file for Solr. File is in the rails log/ directory.
      #
      def log_file
        File.join(::Rails.root, 'log', "sunspot-solr-#{::Rails.env}.log")
      end

      # 
      # Minimum Java heap size for Solr
      #
      def min_memory
        configuration.min_memory
      end

      # 
      # Maximum Java heap size for Solr
      #
      def max_memory
        configuration.max_memory
      end

      private

      #
      # access to the Sunspot::Rails::Configuration, defined in
      # sunspot.yml. Use Sunspot::Rails.configuration if you want
      # to access the configuration directly.
      #
      # ==== returns
      #
      # Sunspot::Rails::Configuration:: configuration
      #
      def configuration
        Sunspot::Rails.configuration
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sunspot_rails-2.2.2 lib/sunspot/rails/server.rb
sunspot_rails-2.2.1 lib/sunspot/rails/server.rb