Commit 633ed632 by Thanh Hung Pham

Search all if search text empty

parent fb632524
......@@ -56,7 +56,7 @@ class JobsController < ApplicationController
rsolr = RSolr.connect url: 'http://localhost:8983/solr/veNJOBDATA/'
response = rsolr.get 'select', params: {
q: @search_text.gsub(/\s[^0-9a-z ]/i, ''),
q: @search_text.blank? ? '*:*' : @search_text.gsub(/\s[^0-9a-z ]/i, ''),
start: 0,
rows: 100_000_000
}
......@@ -65,9 +65,8 @@ class JobsController < ApplicationController
response['response']['docs'].each do |doc|
@job_ids.push(doc['job_id'])
end
@job_ids = Job.limit(20).ids if @job_ids.length.zero?
@job_count = Job.where(id: @job_ids).count
@job_count = response['response']['numFound']
@jobs = Job.where(id: @job_ids).page params[:page]
@search_conditions = "All jobs in #{@search_text}"
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