Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
updates for elasticsearch
Browse files Browse the repository at this point in the history
  • Loading branch information
dvito committed Aug 25, 2016
1 parent 779ccb6 commit e508694
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ REGISTRY_EMAIL_USER=test@gmail.com
REGISTRY_EMAIL_PASS=testpassword

REGISTRY_DB_NAME=ringsail_development
REGISTRY_DB_HOST=db
REGISTRY_DB_HOST=localhost
REGISTRY_DB_PORT=3306
REGISTRY_DB_USER=root
REGISTRY_DB_PASS=

REGISTRY_ES_HOST=localhost
REGISTRY_ES_PORT=9200
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source 'http://rubygems.org'
ruby ENV['RUBY_VERSION']
#ruby ENV['RUBY_VERSION']

# Rails
gem 'rails', '4.2.5'
Expand Down Expand Up @@ -43,7 +43,7 @@ gem 'rack-cors', :require => 'rack/cors'
gem 'unicorn'

# generate fake data in tests & seeds files
gem 'faker'
#gem 'faker'

gem 'elasticsearch-model'
gem 'elasticsearch-rails'
Expand Down
6 changes: 0 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,3 @@ DEPENDENCIES
to_regexp
uglifier
unicorn

RUBY VERSION
ruby 2.1.5p273

BUNDLED WITH
1.12.5
8 changes: 5 additions & 3 deletions app/controllers/admin/social_media_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ def index
respond_to do |format|
format.html { @outlets = [] }
format.json {

@outlets = Outlet.search("a", {}).page(1).records

if params[:q]
@outlets = Outlet.search(params[:q], {}).page(1).records
else
@outlets = @outlets.page(1)
end
}
format.csv { send_data @outlets.to_csv }
end
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/social_media/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
$(document).ready(function() {

data_tables = $('#data-tables').dataTable({
"processing": true,
"serverside" : true,
"ajax" : {
"url":"/admin/social_media.json",
"data": function(d){
Expand Down
8 changes: 8 additions & 0 deletions config/initializers/elasticsearch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config = {
host: "http://#{ENV['REGISTRY_ES_HOST']}:#{ENV['REGISTRY_ES_PORT']}/",
transport_options: {
request: { timeout: 5 }
},
}

Elasticsearch::Model.client = Elasticsearch::Client.new(config)

0 comments on commit e508694

Please sign in to comment.