Skip to content
Snippets Groups Projects
Commit 8850e2f0 authored by Felipe Bombardelli's avatar Felipe Bombardelli
Browse files

Add the function autocomplete in the controller

parent 10ea1db2
No related branches found
No related tags found
No related merge requests found
class SearchController < ApplicationController
include SearchEngine::OrientdbLucene
def index
end
......@@ -45,6 +46,20 @@ class SearchController < ApplicationController
render partial: 'search/fetch'
end
def autocomplete
begin
query = params["q"] || ""
json_data = open( "http://localhost:4242?q=#{query}" ).read
render text: json_data
rescue
render text: "[]"
end
end
private
def build_page_result(objects, page, limit)
......@@ -59,4 +74,6 @@ class SearchController < ApplicationController
# items.each{ |item| item['author'] = order_author(item['author']) if (item['author'].nil? ? [] : item['author']).size > 0 }
items
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment