- removed our copy jquery & bootstrap. using cdn instead
- added search box to the header - made reindex rake task
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user