Commit 156a27e7 by Thanh Hung Pham

Add rsolr success

parent e089ae33
...@@ -30,6 +30,7 @@ gem 'jbuilder', '~> 2.5' ...@@ -30,6 +30,7 @@ gem 'jbuilder', '~> 2.5'
# gem 'redis', '~> 3.0' # gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password # Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7' gem 'bcrypt', '~> 3.1.7'
gem 'rsolr'
gem 'whenever' gem 'whenever'
# Use Capistrano for deployment # Use Capistrano for deployment
......
...@@ -80,6 +80,8 @@ GEM ...@@ -80,6 +80,8 @@ GEM
erubi (1.6.1) erubi (1.6.1)
erubis (2.7.0) erubis (2.7.0)
execjs (2.7.0) execjs (2.7.0)
faraday (0.12.1)
multipart-post (>= 1.2, < 3)
ffi (1.9.18) ffi (1.9.18)
figaro (1.1.1) figaro (1.1.1)
thor (~> 0.14) thor (~> 0.14)
...@@ -120,6 +122,7 @@ GEM ...@@ -120,6 +122,7 @@ GEM
mini_portile2 (2.2.0) mini_portile2 (2.2.0)
minitest (5.10.2) minitest (5.10.2)
multi_json (1.12.1) multi_json (1.12.1)
multipart-post (2.0.0)
mysql2 (0.4.7) mysql2 (0.4.7)
nio4r (2.1.0) nio4r (2.1.0)
nokogiri (1.8.0) nokogiri (1.8.0)
...@@ -160,6 +163,9 @@ GEM ...@@ -160,6 +163,9 @@ GEM
responders (2.4.0) responders (2.4.0)
actionpack (>= 4.2.0, < 5.3) actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3) railties (>= 4.2.0, < 5.3)
rsolr (2.0.2)
builder (>= 2.1.2)
faraday
ruby_dep (1.5.0) ruby_dep (1.5.0)
rubyzip (1.2.1) rubyzip (1.2.1)
sass (3.4.24) sass (3.4.24)
...@@ -228,6 +234,7 @@ DEPENDENCIES ...@@ -228,6 +234,7 @@ DEPENDENCIES
mysql2 (>= 0.3.18, < 0.5) mysql2 (>= 0.3.18, < 0.5)
puma (~> 3.7) puma (~> 3.7)
rails (~> 5.1.1) rails (~> 5.1.1)
rsolr
rubyzip rubyzip
sass-rails (~> 5.0) sass-rails (~> 5.0)
selenium-webdriver selenium-webdriver
......
require 'rsolr'
class JobsController < ApplicationController class JobsController < ApplicationController
def applied_jobs def applied_jobs
@applied_jobs = Apply.where(user_id: current_user.id) @applied_jobs = Apply.where(user_id: current_user.id)
...@@ -6,6 +8,21 @@ class JobsController < ApplicationController ...@@ -6,6 +8,21 @@ class JobsController < ApplicationController
def search def search
@search_conditions = params[:text_search] @search_conditions = params[:text_search]
rsolr = RSolr.connect url: 'http://localhost:8983/solr/veNJOBDATA/'
# rsolr.add(job_id: 1, job_name: 'a', job_description: 'b')
# rsolr.update data: '<commit/>', headers: { 'Content-Type' => 'text/xml' }
# rsolr.update data: { optimize: true }.to_json, headers: { 'Content-Type' => 'application/json' }
# rsolr.commit
response = rsolr.get 'select', params: { q: @search_conditions, start: 0, rows: 10 }
response['response']['docs']
raise 'test'
# search = rsolr.select params: { q: @search_conditions }
# search['response']['docs']
redirect_to jobs_show_path redirect_to jobs_show_path
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment