- removed our copy jquery & bootstrap. using cdn instead

- added search box to the header
- made reindex rake task
This commit is contained in:
Edin Dazdarevic
2015-05-25 20:49:52 +02:00
parent c99bcbda7a
commit e1be044fd9
14 changed files with 154 additions and 88 deletions

View File

@@ -1,32 +1,3 @@
# TODO: make this private, not-public facing.
# for now we keep this here for simplicity reasons
get '/search/index' 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
"ok".to_json
end
get '/search' do
es_client = Elasticsearch::Client.new log: true
q = params[:q]