Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
V
VeNJOB
  • 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 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Nguyen Hoang Mai Phuong
  • VeNJOB
  • Merge Requests
  • !12

Merged
Opened Oct 14, 2021 by Nguyen Hoang Mai Phuong@phuongnhm 
  • Report abuse
Report abuse

search-function

×

Check out, review, and merge locally

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

git fetch origin
git checkout -b search-funtion origin/search-funtion

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 search-funtion

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 7
  • Commits 4
  • Pipelines 4
  • Changes 11
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Oct 15, 2021
    Last updated by Nguyen Hoang Mai Phuong Oct 19, 2021
    app/controllers/jobs_controller.rb
    21 21 @job = Job.find_by(slug: params[:job_slug]) or not_found
    22 22 end
    23 23
    24 def search
    25 @keyword = job_params[:search].gsub!(/[^[:alnum:]]/, ' ')
    26 solr = RSolr.connect url: 'http://localhost:8983/solr/VeNJOB'
    • Thanh Hung Pham @hungpt commented Oct 15, 2021
      Master

      @phuongnhm Nhìn sơ qua thì solr của em có dùng nhiều chỗ.

      • Build phần solr ra thành một class riêng trong thư mục lib á, ví dụ: SolrSearch

      • Khi chỗ nào dùng thì chỉ cần SolrSearch.new(param_cần_thiết)

      • Mỗi chức năng thì build function riêng trong class đó.

      @phuongnhm Nhìn sơ qua thì solr của em có dùng nhiều chỗ. - Build phần solr ra thành một class riêng trong thư mục `lib` á, ví dụ: `SolrSearch` - Khi chỗ nào dùng thì chỉ cần `SolrSearch.new(param_cần_thiết)` - Mỗi chức năng thì build function riêng trong class đó.
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 2 of the diff

      Oct 19, 2021

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/12/diffs?diff_id=5530&start_sha=488000a47a0cb542d62f4854e99b479b595d3f41#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_26_26)
      Toggle commit list
    Please register or sign in to reply
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • ebd5b445 - create class Solrsearch

    Compare with previous version

    Oct 19, 2021

    added 1 commit

    • ebd5b445 - create class Solrsearch

    Compare with previous version

    added 1 commit * ebd5b445 - create class Solrsearch [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/12/diffs?diff_id=5530&start_sha=488000a47a0cb542d62f4854e99b479b595d3f41)
    Toggle commit list
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Oct 20, 2021
    Last updated by Nguyen Hoang Mai Phuong Oct 21, 2021
    app/controllers/jobs_controller.rb
    21 21 @job = Job.find_by(slug: params[:job_slug]) or not_found
    22 22 end
    23 23
    24 def search
    25 @keyword = job_params[:search].gsub!(/[^[:alnum:]]/, ' ')
    26 search_param = SolrSearch.new.search(@keyword)
    • Thanh Hung Pham @hungpt commented Oct 20, 2021
      Master

      @phuongnhm

      • Đặt lại tên biến cho dễ hiểu em. Cái này kết quả search trả về mà, sao đặt là search_param?

      • Anh thấy em đang query hết kết quả trên Solr về.

       start: 0,
       rows: 2_147_483_647
      • Em tham khảo phần paging bằng Solr nè. https://github.com/rsolr/rsolr#pagination-
      Edited Oct 20, 2021 by Thanh Hung Pham
      @phuongnhm - Đặt lại tên biến cho dễ hiểu em. Cái này kết quả search trả về mà, sao đặt là `search_param`? - Anh thấy em đang query hết kết quả trên Solr về. ``` start: 0, rows: 2_147_483_647 ``` - Em tham khảo phần paging bằng Solr nè. https://github.com/rsolr/rsolr#pagination-
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 3 of the diff

      Oct 21, 2021

      changed this line in version 3 of the diff

      changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/12/diffs?diff_id=5531&start_sha=ebd5b445a40e3a67eb509d0365415a68910d6462#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_26_26)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Oct 20, 2021
    Last updated by Nguyen Hoang Mai Phuong Oct 21, 2021
    app/helpers/application_helper.rb
    28 28 def favorite_text(job)
    29 29 FavoriteJob.find_by(job: job, user: current_user).present? ? 'Unfavorite' : 'Favorite'
    30 30 end
    31
    32 def search(input)
    • Thanh Hung Pham @hungpt commented Oct 20, 2021
      Master

      @phuongnhm

      • Tại sao phải viết thêm cái helper này nhỉ? Sao không dùng luôn kết quả từ Solr trả về?
      • Mà sau này có viết method mới cũng nên chú ý:
        • Tên method cho rõ ràng nội dung của method, đọc vào dễ hiểu
        • Tương tự tên tham số truyền vào cũng vậy
      @phuongnhm - Tại sao phải viết thêm cái helper này nhỉ? Sao không dùng luôn kết quả từ Solr trả về? - Mà sau này có viết method mới cũng nên chú ý: - Tên method cho rõ ràng nội dung của method, đọc vào dễ hiểu - Tương tự tên tham số truyền vào cũng vậy
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 3 of the diff

      Oct 21, 2021

      changed this line in version 3 of the diff

      changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/12/diffs?diff_id=5531&start_sha=ebd5b445a40e3a67eb509d0365415a68910d6462#040453e670f9bf522378f941c96f3881076fee1f_32_32)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Oct 20, 2021
    Last updated by Nguyen Hoang Mai Phuong Oct 21, 2021
    lib/solr/solr_search.rb 0 → 100644
    1 class SolrSearch
    2 def initialize
    3 @solr = RSolr.connect url: 'http://localhost:8983/solr/VeNJOB'
    4 end
    5
    6 def search(keyword)
    7 response = @solr.get 'select', params: {
    8 q: "cities_name: #{keyword}* or title: #{keyword}* or industries_name: #{keyword}* or company_name: #{keyword}*",
    • Thanh Hung Pham @hungpt commented Oct 20, 2021
      Master

      @phuongnhm * này ý nghĩa là gì vậy em?

      @phuongnhm `*` này ý nghĩa là gì vậy em?
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 3 of the diff

      Oct 21, 2021

      changed this line in version 3 of the diff

      changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/12/diffs?diff_id=5531&start_sha=ebd5b445a40e3a67eb509d0365415a68910d6462#f5d2e00bbb4033a7f5d46e00b5e9d282985b376d_8_7)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Oct 20, 2021
    Last updated by Nguyen Hoang Mai Phuong Oct 21, 2021
    lib/solr/solr_search.rb 0 → 100644
    1 class SolrSearch
    2 def initialize
    3 @solr = RSolr.connect url: 'http://localhost:8983/solr/VeNJOB'
    4 end
    5
    6 def search(keyword)
    7 response = @solr.get 'select', params: {
    8 q: "cities_name: #{keyword}* or title: #{keyword}* or industries_name: #{keyword}* or company_name: #{keyword}*",
    9 fl: %w[job_id slug],
    10 start: 0,
    • Thanh Hung Pham @hungpt commented Oct 20, 2021
      Master

      @phuongnhm

      • Anh có review ở trên á. Em tham khảo phần paging của Solr á.
      start: 0,
      rows: 2_147_483_647
      Edited Oct 20, 2021 by Thanh Hung Pham
      @phuongnhm - Anh có review ở trên á. Em tham khảo phần paging của Solr á. ``` start: 0, rows: 2_147_483_647 ```
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 3 of the diff

      Oct 21, 2021

      changed this line in version 3 of the diff

      changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/12/diffs?diff_id=5531&start_sha=ebd5b445a40e3a67eb509d0365415a68910d6462#f5d2e00bbb4033a7f5d46e00b5e9d282985b376d_10_7)
      Toggle commit list
    Please register or sign in to reply
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • f286a516 - fix method query job from solr and pagination

    Compare with previous version

    Oct 21, 2021

    added 1 commit

    • f286a516 - fix method query job from solr and pagination

    Compare with previous version

    added 1 commit * f286a516 - fix method query job from solr and pagination [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/12/diffs?diff_id=5531&start_sha=ebd5b445a40e3a67eb509d0365415a68910d6462)
    Toggle commit list
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Oct 21, 2021
    Last updated by Nguyen Hoang Mai Phuong Oct 22, 2021
    lib/solr/solr_search.rb 0 → 100644
    1 class SolrSearch
    2 def initialize
    3 @solr = RSolr.connect url: 'http://localhost:8983/solr/VeNJOB'
    4 end
    5
    6 def search(keyword)
    7 response = @solr.paginate 1, 2_147_483_647, 'select', params: {
    • Thanh Hung Pham @hungpt commented Oct 21, 2021
      Master

      @phuongnhm

      • Cái này mà paging gì em?
      • Em truyền cố định 2 số như vậy 1, 2_147_483_647 thì làm sao nó paging được?
      • Em phải lấy giá trị page hiện tại trên giao diện để truyền vào chứ.
      @phuongnhm - Cái này mà paging gì em? - Em truyền cố định 2 số như vậy `1, 2_147_483_647` thì làm sao nó paging được? - Em phải lấy giá trị page hiện tại trên giao diện để truyền vào chứ.
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 4 of the diff

      Oct 22, 2021

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/12/diffs?diff_id=5532&start_sha=f286a51604849c8295c5a472e6adb4d0fb7d5911#f5d2e00bbb4033a7f5d46e00b5e9d282985b376d_7_6)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Oct 21, 2021
    Last updated by Nguyen Hoang Mai Phuong Oct 22, 2021
    app/views/jobs/search.html.slim 0 → 100644
    1 .container.p-3
    2 h5.fw-normal
    3 | Total:
    4 = pluralize(@total, 'job')
    5 h5.fw-normal
    6 | Result for:
    7 = @keyword
    8 .d-flex.justify-content-center.p-2
    9 = paginate @result_search, window: 1
    10 .job-list
    11 - @result_search.each do |job|
    12 .row.bg-white
    13 .col-10.p-3.card-body.text-dark
    14 h5.mb-1
    15 = link_to query_job(job).title, detail_path(job['slug'])
    • Thanh Hung Pham @hungpt commented Oct 21, 2021
      Master

      @phuongnhm Hiện tại em dùng đi dùng lại rất nhiều lần trong view, mỗi lần gọi query_job(job) nó sẽ query xuống DB. như vậy không tốt

      @phuongnhm Hiện tại em dùng đi dùng lại rất nhiều lần trong view, mỗi lần gọi `query_job(job)` nó sẽ query xuống DB. như vậy không tốt
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 4 of the diff

      Oct 22, 2021

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/12/diffs?diff_id=5532&start_sha=f286a51604849c8295c5a472e6adb4d0fb7d5911#95d9cce6bc5957471b2d9a96cd5116091c296dfc_15_15)
      Toggle commit list
    Please register or sign in to reply
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • 42fd7020 - fix paginaion and refactor controller

    Compare with previous version

    Oct 22, 2021

    added 1 commit

    • 42fd7020 - fix paginaion and refactor controller

    Compare with previous version

    added 1 commit * 42fd7020 - fix paginaion and refactor controller [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/12/diffs?diff_id=5532&start_sha=f286a51604849c8295c5a472e6adb4d0fb7d5911)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    mentioned in commit 76e39781

    Oct 28, 2021

    mentioned in commit 76e39781

    mentioned in commit 76e397816cfa752cf9853d9a2b0d78dfb2cdd5c1
    Toggle commit list
  • Thanh Hung Pham @hungpt

    merged

    Oct 28, 2021

    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: phuongnhm/VeNJOB!12
×

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.