Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
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
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyen Ngoc Nghia
VeNJOB
Commits
5e442bda
Commit
5e442bda
authored
Feb 20, 2020
by
nnnghia98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change params pass into @search
parent
ca3f0a29
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
app/controllers/jobs_controller.rb
+1
-1
app/services/solr_service.rb
+5
-5
No files found.
app/controllers/jobs_controller.rb
View file @
5e442bda
...
...
@@ -4,7 +4,7 @@ class JobsController < ApplicationController
before_action
:validate_city_industry
,
only: :index
def
index
@search
=
params
[
:search
]
||
params
[
:city_id
]
||
params
[
:industry_id
]
||
":"
@search
=
params
solr
=
SolrService
.
new
(
@search
)
if
params
[
:city_id
]
...
...
app/services/solr_service.rb
View file @
5e442bda
require
"rsolr"
class
SolrService
def
initialize
(
search_keyword
=
{
})
def
initialize
(
params
=
{
search:
"*:*"
})
@solr
=
RSolr
.
connect
(
url:
Settings
.
solr
.
connection
.
server_url
,
read_timeout:
Settings
.
solr
.
connection
.
read_timeout
,
...
...
@@ -9,7 +9,7 @@ class SolrService
retry_503:
Settings
.
solr
.
connection
.
retry_503
)
@
search_keyword
=
search_keyword
@
params
=
params
end
def
add_data
...
...
@@ -49,14 +49,14 @@ class SolrService
end
def
query_all
q
=
"*
#{
@
search_keyword
}
*"
q
=
"*
#{
@
params
[
:search
]
}
*"
fq
=
""
send_request
(
q
,
fq
)
end
def
query_by_city
city
=
City
.
find_by
(
id:
@
search_keyword
)
city
=
City
.
find_by
(
id:
@
params
[
:city_id
]
)
return
{
"numFound"
:
0
,
"docs"
:
[]
}
unless
city
city_name
=
city
.
name
...
...
@@ -69,7 +69,7 @@ class SolrService
end
def
query_by_industry
industry
=
Industry
.
find_by
(
id:
@
search_keyword
)
industry
=
Industry
.
find_by
(
id:
@
params
[
:industry_id
]
)
return
{
"numFound"
:
0
,
"docs"
:
[]
}
unless
industry
industry_name
=
industry
.
name
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment