Skip to content

Commit

Permalink
Allow specification of min_memory and max_memory in config/sunspot.yml
Browse files Browse the repository at this point in the history
[sunspot#87 state:resolved]
  • Loading branch information
Mat Brown committed Mar 11, 2010
1 parent 402fe53 commit 13f34db
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
16 changes: 16 additions & 0 deletions sunspot_rails/lib/sunspot/rails/configuration.rb
Expand Up @@ -9,6 +9,8 @@ module Rails #:nodoc:
# solr:
# hostname: localhost
# port: 8982
# min_memory: 512M
# max_memory: 1G
# test:
# solr:
# hostname: localhost
Expand Down Expand Up @@ -194,6 +196,20 @@ def solr_home
File.join(::Rails.root, 'solr')
end
end

#
# Minimum java heap size for Solr instance
#
def min_memory
@min_memory ||= user_configuration_from_key('solr', 'min_memory')
end

#
# Maximum java heap size for Solr instance
#
def max_memory
@max_memory ||= user_configuration_from_key('solr', 'max_memory')
end

private

Expand Down
14 changes: 14 additions & 0 deletions sunspot_rails/lib/sunspot/rails/server.rb
Expand Up @@ -91,6 +91,20 @@ 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

#
Expand Down
2 changes: 1 addition & 1 deletion sunspot_rails/spec/mock_app/config/sunspot.yml
Expand Up @@ -16,4 +16,4 @@ config_test:
pid_path: /my_superior_path/pids
solr_home: /my_superior_path
auto_commit_after_request: false
auto_commit_after_delete_request: true
auto_commit_after_delete_request: true

0 comments on commit 13f34db

Please sign in to comment.