Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
V
venjobs_app
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Quang Vinh Nguyen
  • venjobs_app
  • Merge Requests
  • !7

Merged
Opened Jun 21, 2018 by Quang Vinh Nguyen@vinhnq 
  • Report abuse
Report abuse

update solr search tokenize, search_text fix string to text

×

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b update-solr-search origin/update-solr-search

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git checkout master
git merge --no-ff update-solr-search

Step 4. Push the result of the merge to GitLab

git push origin master

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

  • Discussion 5
  • Commits 3
  • Changes 22
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 21, 2018
    Last updated by Quang Vinh Nguyen Jun 21, 2018
    app/controllers/jobs_controller.rb
    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])
    • Van Toan Vu @toanvv commented Jun 21, 2018
      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

      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
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 21, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/7/diffs?diff_id=3923&start_sha=08d9d237e1efc55617b29c1d526d9a1ef3e260d3#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_23_17)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on the diff Jun 21, 2018
    app/controllers/jobs_controller.rb
    20 35
    21 36 def home
    22 37 @jobs = Job.all.order(updated_at: :desc).take(5)
    • Van Toan Vu @toanvv commented Jun 21, 2018
      Master

      use solr sort

      use solr sort
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 21, 2018
    Last updated by Quang Vinh Nguyen Jun 21, 2018
    app/controllers/jobs_controller.rb
    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)
    • Van Toan Vu @toanvv commented Jun 21, 2018
      Master

      put to somewhere for another code can use this function too

      Edited Jun 21, 2018 by Van Toan Vu
      put to somewhere for another code can use this function too
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 21, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/7/diffs?diff_id=3923&start_sha=08d9d237e1efc55617b29c1d526d9a1ef3e260d3#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_41_33)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 21, 2018
    Last updated by Quang Vinh Nguyen Jun 21, 2018
    app/models/job.rb
    1 1 # frozen_string_literal: true
    2 2
    3 3 class Job < ApplicationRecord
    4 attr_accessor :page_per
    • Van Toan Vu @toanvv commented Jun 21, 2018
      Master

      please this put one on config

      please this put one on config
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 21, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/7/diffs?diff_id=3923&start_sha=08d9d237e1efc55617b29c1d526d9a1ef3e260d3#742abd5cbc2b12d2da315862ace6297c7d6dcb87_4_4)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 21, 2018
    Last updated by Quang Vinh Nguyen Jun 21, 2018
    app/models/job.rb
    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
    • Van Toan Vu @toanvv commented Jun 21, 2018
      Master

      it should be ex: paginates_per Settings.solr.per_page

      Edited Jun 21, 2018 by Van Toan Vu
      it should be ex: `paginates_per Settings.solr.per_page`
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 21, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/7/diffs?diff_id=3923&start_sha=08d9d237e1efc55617b29c1d526d9a1ef3e260d3#742abd5cbc2b12d2da315862ace6297c7d6dcb87_38_36)
      Toggle commit list
    Please register or sign in to reply
  • Quang Vinh Nguyen @vinhnq

    added 1 commit

    • fc55b92c - update ActiveRecord -- RecordNotFound handle

    Compare with previous version

    Jun 21, 2018

    added 1 commit

    • fc55b92c - update ActiveRecord -- RecordNotFound handle

    Compare with previous version

    added 1 commit * fc55b92c - update ActiveRecord -- RecordNotFound handle [Compare with previous version](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/7/diffs?diff_id=3923&start_sha=08d9d237e1efc55617b29c1d526d9a1ef3e260d3)
    Toggle commit list
  • Quang Vinh Nguyen @vinhnq

    added 1 commit

    • 2436a696 - fix some rubocop error

    Compare with previous version

    Jun 21, 2018

    added 1 commit

    • 2436a696 - fix some rubocop error

    Compare with previous version

    added 1 commit * 2436a696 - fix some rubocop error [Compare with previous version](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/7/diffs?diff_id=3924&start_sha=fc55b92c7cc888281882a44023985175196c8070)
    Toggle commit list
  • Quang Vinh Nguyen @vinhnq

    mentioned in commit df57c21f

    Jun 21, 2018

    mentioned in commit df57c21f

    mentioned in commit df57c21fef33260d6458d109a481b152c25ccbd3
    Toggle commit list
  • Quang Vinh Nguyen @vinhnq

    merged

    Jun 21, 2018

    merged

    merged
    Toggle commit list
  • Write
  • Preview
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 sign in to comment
Assignee
No assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
2
2 participants
Reference: vinhnq/venjobs_app!7
×

Revert this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.
×

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.