Commit bc15b910 by Thanh Hung Pham

Show search result

parent 5c9cf52e
...@@ -72,6 +72,7 @@ class JobsController < ApplicationController ...@@ -72,6 +72,7 @@ class JobsController < ApplicationController
@job_count = Job.where(id: params[:job_ids]).count @job_count = Job.where(id: params[:job_ids]).count
@jobs = Job.where(id: params[:job_ids]).page params[:page] @jobs = Job.where(id: params[:job_ids]).page params[:page]
@search_conditions = "All jobs in #{params[:search_conditions]}" @search_conditions = "All jobs in #{params[:search_conditions]}"
@search_text = params[:search_conditions]
end end
end end
......
class Job < ApplicationRecord class Job < ApplicationRecord
after_save :import_solr
belongs_to :city, optional: true belongs_to :city, optional: true
belongs_to :company, optional: true belongs_to :company, optional: true
belongs_to :job_type, optional: true belongs_to :job_type, optional: true
...@@ -10,12 +9,4 @@ class Job < ApplicationRecord ...@@ -10,12 +9,4 @@ class Job < ApplicationRecord
paginates_per 20 paginates_per 20
validates :name, presence: true, length: { maximum: 200 } validates :name, presence: true, length: { maximum: 200 }
private
def import_solr
rsolr = RSolr.connect url: 'http://localhost:8983/solr/veNJOBDATA/'
rsolr.add(job_id: id, job_name: name, job_description: description)
rsolr.commit
end
end end
<%= form_tag jobs_search_path do %> <%= form_tag jobs_search_path do %>
<div class="row form-group"> <div class="row form-group">
<div class="col-md-10"> <div class="col-md-10">
<%= text_area_tag 'text_search', '', class: 'form-control' %> <%= text_area_tag 'text_search', @search_text, class: 'form-control' %>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<%= submit_tag 'Search', class: 'btn btn-primary' %> <%= submit_tag 'Search', class: 'btn btn-primary' %>
......
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