update solr search tokenize, search_text fix string to text
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
-
9 @job_num = job_found[:num] 10 job_search_result = Job.where(id: @job_ids) 11 @jobs = Kaminari.paginate_array(job_search_result, 12 total_count: @job_num). 13 page(params[:page]). 14 per(Kaminari.config.default_per_page) 15 6 16 end 7 17 8 18 def show 9 @job = Job.find(params[:id]) 19 @job = Job.find_by(id: params[:id]) 20 unless @job.nil? 21 return @job 22 else 23 job_not_found(params[:id]) -
Master
you should use rescue_from to handler record not found and put them on application_controller, so when city, jobs not found for examples, they will have you handle them all https://apidock.com/rails/ActiveSupport/Rescuable/ClassMethods/rescue_from
-
-
-
20 35 21 36 def home 22 37 @jobs = Job.all.order(updated_at: :desc).take(5) -
Master
use solr sort
-
-
21 36 def home 22 37 @jobs = Job.all.order(updated_at: :desc).take(5) 23 @cities = City.all.select{ |city| city.jobs.any? }.take(8) 38 @cities = City.all.select { |city| city.jobs.any? }.take(8) 24 39 end 25 40 26 def get_jobs_rsolr(title = '*') 27 solr = RSolr.connect url: 'http://localhost:8983/solr/gettingstarted/' 28 search_params = { q: "search_text:*#{title.downcase}*", rows: 5_000 } 29 response_solr = solr.get 'select', params: search_params 30 if response_solr['response']['docs'].any? 31 response_solr['response']['docs'].collect do |row| 32 row['job_id'] 33 end 34 end 41 def job_not_found(id) -
Master
-
-
-
1 1 # frozen_string_literal: true 2 2 3 3 class Job < ApplicationRecord 4 attr_accessor :page_per -
Master
please this put one on config
-
-
-
33 34 validates :condition, presence: true, length: { maximum: 1000 } 34 35 validates :link, presence: true 35 36 36 paginates_per 10 37 38 def self.search(search) 39 where("title LIKE ?", "%#{search}%") 37 @page_per = 10 38 paginates_per @page_per -
Master
-
-
-
-
-
merged
Toggle commit list