pdf_search 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/web_server.rb +4 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0065603502c39c83fa745999caddc68dddb1e20b2057ed5dada9c83bc13aee86
4
- data.tar.gz: a00f82932808e7d7edb9315a30cb4bf88c4627ca69265257389e9f0a2d93dca3
3
+ metadata.gz: 44d5c7c69ebe317bcd1c609a1a93c33f2f180839f58e98180d984b1ab170cb1c
4
+ data.tar.gz: 2d607c5f7e6ffeb8b8667821486855f657681fc3c8332aebd315c3d5da8dc686
5
5
  SHA512:
6
- metadata.gz: fba51e68bc3af4e94306fd17553b55703a2455b51e50c7e4a1b2bfa2f41f17a87d0aead727b5903f296d8150228bc884504d4aab89e2f393d86b47fa7604f39f
7
- data.tar.gz: 890e67818d697c417e86590c3bdd15f3de67c3362d3c0b6d1cc34e704eccff9189846ff5fbbe444a6e471e42f2a2cd62c7f695024384f7b5b19b87a6be1ff39e
6
+ metadata.gz: 23bfdd1a6cf8da807f26e68aa48093d0afd610bf44aa580b4018c7a41de70da36a198746876287b5dcd1deb60d9aef9301b130b792ead9a77013db6d1bd24713
7
+ data.tar.gz: c5e50bb4a3b7f4c54fd69ff249feddc484ca32b4060873dfd63967b21cf09374e0ab6af9329f60d1500a1199b74afdc0d0b6665c4169a4ea0192f013d8df37f5
data/lib/web_server.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'webrick'
2
+ require 'json'
2
3
 
3
4
  class PdfSearch::WebServer
4
5
  attr_accessor :daemon
@@ -9,7 +10,7 @@ class PdfSearch::WebServer
9
10
 
10
11
  server.mount_proc '/search' do |request, response|
11
12
  query = request.query["query"]
12
- elastic_response = Net::HTTP.get(URI.parse("#{ENV['ELASTICSEARCH_URL']}/_all/_search?q=text:#{query}"))
13
+ elastic_response = ::PdfSearch::ElasticSearchClient.search q: "text:#{query}"
13
14
  response.body = response_html(elastic_response)
14
15
  end
15
16
 
@@ -23,9 +24,8 @@ class PdfSearch::WebServer
23
24
  end
24
25
  end
25
26
 
26
- def response_html(elasticsearch_response)
27
- results = JSON.parse(elasticsearch_response)['hits']['hits']
28
-
27
+ def response_html(es_response)
28
+ results = es_response['hits']['hits']
29
29
  results.map do |result|
30
30
  "<li>#{result["_source"]["text"]}</li>"
31
31
  end.join("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdf_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Arno Korfmann