Commit 51c62156 by Hoang Phuc

Import data for Sorl

parent 6bec22a7
Pipeline #585 canceled with stages
in 0 seconds
...@@ -5,7 +5,7 @@ namespace :solr do ...@@ -5,7 +5,7 @@ namespace :solr do
solr = RSolr.connect :url => "http://localhost:8983/solr/venjob" solr = RSolr.connect :url => "http://localhost:8983/solr/venjob"
task import: :environment do task import: :environment do
job = Job.last(1) job = Job.all
hash_jobs = job.map { |item| hash_jobs = job.map { |item|
salary = 0 salary = 0
min_salary = 0 min_salary = 0
...@@ -13,13 +13,13 @@ namespace :solr do ...@@ -13,13 +13,13 @@ namespace :solr do
{ {
job_id: item.id, job_id: item.id,
title: item.title, title: item.title,
updated_date_job: DateTime.parse(item.updated_date_job).to_i, updated_date_job: item.updated_date_job.nil? ? 0 : DateTime.parse(item.updated_date_job).to_i,
level: item.level, level: item.level,
years_of_experience: item.years_of_experience, years_of_experience: item.years_of_experience,
salary: salary, salary: salary,
min_salary: min_salary, min_salary: min_salary,
max_salary: max_salary, max_salary: max_salary,
expiration_date: DateTime.parse(item.expiration_date).to_i, expiration_date: item.expiration_date.nil? ? 0 : DateTime.parse(item.expiration_date).to_i,
job_description: item.job_description, job_description: item.job_description,
created_at: item.created_at.to_i, created_at: item.created_at.to_i,
industry_ids: item.industries.map { |industry| industry.id }, industry_ids: item.industries.map { |industry| industry.id },
......
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