Skip to content
Snippets Groups Projects
Commit 2930f576 authored by Alexandre Primault's avatar Alexandre Primault
Browse files

Autocomplete ok

parent bd958e51
Branches feature/autocomplete
No related tags found
No related merge requests found
......@@ -17,6 +17,7 @@ gem 'time_difference'
gem 'bcrypt'
gem 'mongo'
gem 'rest-client'
gem 'mongoid'
gem 'bson_ext'
......
......@@ -14,8 +14,12 @@ GEM
bson_ext (1.5.1)
concurrent-ruby (1.1.5)
daemons (1.3.1)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
eventmachine (1.2.7)
ffi (1.10.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
ipaddr (1.2.2)
......@@ -24,6 +28,9 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
minitest (5.11.3)
mongo (2.8.0)
bson (>= 4.4.2, < 5.0.0)
......@@ -32,6 +39,7 @@ GEM
mongo (>= 2.5.1, < 3.0.0)
multi_json (1.13.1)
mustermann (1.0.3)
netrc (0.11.0)
openssl (2.1.2)
ipaddr
power_assert (1.1.4)
......@@ -45,6 +53,10 @@ GEM
ffi (~> 1.0)
rerun (0.13.0)
listen (~> 3.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
ruby_dep (1.5.0)
sinatra (2.0.5)
mustermann (~> 1.0)
......@@ -71,6 +83,9 @@ GEM
activesupport (~> 5.1)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
PLATFORMS
ruby
......@@ -85,6 +100,7 @@ DEPENDENCIES
rack
rack-test
rerun
rest-client
sinatra
sinatra-contrib
sinatra-cors
......
......@@ -6,6 +6,7 @@ require 'time_difference'
require "sinatra/namespace"
require 'sinatra/cors'
require 'mongo'
require 'rest-client'
set :bind, '0.0.0.0'
set :allow_origin, "http://localhost:9998 http://localhost:9999 http://localhost:9997 http://localhost"
......
get '/autocomplete/:search' do
url = "http://eci:eci_pass@americana.univ-lr.fr/solr/devops/suggest?q="+params[:search]
response = RestClient.get(url,headers={})
if response.code == 200
suggests = JSON.parse(response)['suggest']['mySuggester'][params[:search]]['suggestions']
res = []
suggests.each {|suggest|
res.push(suggest['term'])
}
res.to_json
else
halt 400
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