- removed our copy jquery & bootstrap. using cdn instead
- added search box to the header - made reindex rake task
This commit is contained in:
@@ -333,3 +333,32 @@ namespace :ribica do
|
||||
do_import false
|
||||
end
|
||||
end
|
||||
|
||||
namespace :ribica do
|
||||
task reindex: :environment do
|
||||
es_client = Elasticsearch::Client.new log: true
|
||||
|
||||
# first delete the index
|
||||
begin
|
||||
es_client.indices.delete index: 'ribica'
|
||||
rescue
|
||||
logger.warn "Ribica index could not be deleted. Continuing with indexing operation..."
|
||||
end
|
||||
|
||||
# now index items
|
||||
all_items = Item.includes(sub_category: { category: :section }).all.to_a
|
||||
all_items.each do |item|
|
||||
es_client.index index: 'ribica', type: 'items', id: item.id, body: {
|
||||
title: 'Test',
|
||||
name: item.name,
|
||||
code: item.code,
|
||||
description: item.description,
|
||||
sub_category: item.sub_category.name,
|
||||
category: item.sub_category.category.name,
|
||||
section: item.sub_category.category.section.name
|
||||
}
|
||||
end
|
||||
|
||||
puts "ok!"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user