- removed our copy jquery & bootstrap. using cdn instead
- added search box to the header - made reindex rake task
This commit is contained in:
@@ -56,4 +56,4 @@ group :development, :test do
|
||||
gem 'spring'
|
||||
end
|
||||
|
||||
|
||||
gem 'elasticsearch'
|
||||
|
||||
@@ -67,8 +67,18 @@ GEM
|
||||
columnize (0.9.0)
|
||||
debug_inspector (0.0.2)
|
||||
debugger-linecache (1.2.0)
|
||||
elasticsearch (1.0.9)
|
||||
elasticsearch-api (= 1.0.9)
|
||||
elasticsearch-transport (= 1.0.9)
|
||||
elasticsearch-api (1.0.9)
|
||||
multi_json
|
||||
elasticsearch-transport (1.0.9)
|
||||
faraday
|
||||
multi_json
|
||||
erubis (2.7.0)
|
||||
execjs (2.2.2)
|
||||
faraday (0.9.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
font-awesome-rails (4.3.0.0)
|
||||
railties (>= 3.2, < 5.0)
|
||||
globalid (0.3.0)
|
||||
@@ -98,6 +108,7 @@ GEM
|
||||
mini_portile (0.6.2)
|
||||
minitest (5.5.1)
|
||||
multi_json (1.10.1)
|
||||
multipart-post (2.0.0)
|
||||
nested_form (0.3.2)
|
||||
netrc (0.10.2)
|
||||
nokogiri (1.6.5)
|
||||
@@ -205,6 +216,7 @@ DEPENDENCIES
|
||||
byebug
|
||||
cloudinary
|
||||
coffee-rails (~> 4.1.0)
|
||||
elasticsearch
|
||||
jbuilder (~> 2.0)
|
||||
jquery-rails
|
||||
jquery-ui-rails
|
||||
|
||||
@@ -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