Skip to content

Commit

Permalink
Adds solr_url env config
Browse files Browse the repository at this point in the history
  • Loading branch information
mrharpo committed Apr 19, 2024
1 parent 243bbe0 commit c591dee
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/oai_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def index
@response_date = Time.now.strftime('%FT%T')

@records =
RSolr.connect(url: 'http://localhost:8983/solr/')
RSolr.connect(url: config.solr_url)
.get('select', params: {
'q' => 'access_types:"' + PBCorePresenter::PUBLIC_ACCESS + '"',
'fl' => 'id,timestamp,xml',
Expand Down
2 changes: 1 addition & 1 deletion app/models/pb_core_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def playlist_order
end
def playlist_map
@playlist_map ||= begin
response = RSolr.connect(url: 'http://localhost:8983/solr/').get('select', params:
response = RSolr.connect(url: config.solr_url).get('select', params:
{
'fl' => 'playlist_order,id',
'fq' => "playlist_group:#{playlist_group}",
Expand Down
3 changes: 3 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# Solr URL
config.solr_url = ENV['SOLR_URL'] || 'http://localhost:8983/solr'

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
Expand Down
3 changes: 3 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# Solr URL
config.solr_url = ENV['SOLR_URL'] || 'http://localhost:8983/solr'

# Code is not reloaded between requests.
config.cache_classes = true

Expand Down
3 changes: 3 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# Solr URL
config.solr_url = ENV['SOLR_URL'] || 'http://localhost:8983/solr'

# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
Expand Down
2 changes: 1 addition & 1 deletion scripts/lib/downloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def process_query(query)
q = QueryMaker.translate(query)
$LOG.info("Query solr for #{query}")

@options[:ids] = RSolr.connect(url: 'http://localhost:8983/solr/')
@options[:ids] = RSolr.connect(url: config.solr_url)
.get('select',
params: { q: q, fl: 'id', rows: MAX_ROWS }
)['response']['docs'].map { |doc| doc['id'] }
Expand Down
2 changes: 1 addition & 1 deletion spec/solr/analysis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def analyze(input)
'analysis.fieldvalue' => input,
'analysis.fieldtype' => 'sort'
)
json = URI('http://localhost:8983/solr/blacklight-core/analysis/field?' + params).read
json = URI(config.solr_url + '/blacklight-core/analysis/field?' + params).read
JSON.parse(json)['analysis']['field_types']['sort']['index'].last.last['text']
end
it 'folds diacritics' do
Expand Down

0 comments on commit c591dee

Please sign in to comment.