Commit ccb92b52 by Thanh Hung Pham

Search result

parent 38655032
......@@ -10,10 +10,18 @@ class JobsController < ApplicationController
rsolr = RSolr.connect url: 'http://localhost:8983/solr/veNJOBDATA/'
response = rsolr.get 'select', params: { q: @search_conditions }
job_ids = response['response']['docs']['job_id']
response = rsolr.get 'select', params: {
q: @search_conditions,
start: 0,
rows: 10
}
@job_ids = []
response['response']['docs'].each do |doc|
@job_ids.push(doc['job_id'])
end
redirect_to jobs_show_path(job_ids: job_ids)
redirect_to jobs_show_path(job_ids: @job_ids, search_conditions: @search_conditions)
end
def detail
......@@ -42,7 +50,6 @@ class JobsController < ApplicationController
end
def show
raise 'test'
unless params[:city_id].nil?
@job_count = Job.where(city_id: params[:city_id]).count
@jobs = Job.where(city_id: params[:city_id]).page params[:page]
......@@ -61,6 +68,12 @@ class JobsController < ApplicationController
@jobs = Job.where(company_id: params[:company_id]).page params[:page]
@search_conditions = "All jobs in #{Company.find(params[:company_id]).name}"
end
unless params[:job_ids].nil?
@job_count = Job.where(id: params[:job_ids]).count
@jobs = Job.where(id: params[:job_ids]).page params[:page]
@search_conditions = "All jobs in #{params[:search_conditions]}"
end
end
def favorite
......
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