Commit b7e99753 by nnnghia98

count jobs on Solr

parent 77f70a75
......@@ -13,7 +13,8 @@ class JobsController < ApplicationController
@jobs = @industry.jobs
@jobs = @jobs.page(params[:page]).per(Settings.job.per_page).decorate
else
@jobs = SolrService.new.search(@search)
@jobs_count = SolrService.new.search(@search)["numFound"]
@jobs = SolrService.new.search(@search)["docs"]
end
@jobs = Kaminari.paginate_array(@jobs).page(params[:page]).per(Settings.job.per_page)
......
......@@ -41,7 +41,7 @@ class SolrService
# fq: [industry, city],
rows: Job.count
}
response["response"]["docs"]
response["response"]
end
def escape_str(str)
......
......@@ -4,7 +4,7 @@
<% end %>
<h3>Total: <%= params[:city_id] ? @city.job_count :
(params[:industry_id] ? @industry.job_count : "Will be count on Solr") %></h3>
(params[:industry_id] ? @industry.job_count : @jobs_count) %></h3>
<h3>Result for: <%= params[:city_id] ? "City: #{@city.name}" :
(params[:industry_id] ? "Industry: #{@industry.name}" : params[:search]) %></h3>
......
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