Module: PdfSearch
- Defined in:
- lib/pdf_dir.rb,
lib/pdf_search.rb,
lib/search_view.rb,
lib/elastic_search_query.rb
Defined Under Namespace
Classes: ElasticSearchQuery, PdfDir, PdfIndex, SearchView, WebServer
Constant Summary
collapse
- ElasticSearchClient =
Elasticsearch::Client.new log: true, host: ENV['ELASTICSEARCH_URL']
- GemDir =
[File.dirname(__FILE__), '..']
Class Method Summary
collapse
Class Method Details
.create_elasticsearch_index ⇒ Object
28
29
30
|
# File 'lib/pdf_search.rb', line 28
def self.create_elasticsearch_index
PdfIndex.create_index
end
|
.relative_to_gem_path(path_array) ⇒ Object
14
15
16
|
# File 'lib/pdf_search.rb', line 14
def self.relative_to_gem_path(path_array)
File.expand_path(File.join(GemDir + path_array))
end
|
.start_elasticsearch ⇒ Object
24
25
26
|
# File 'lib/pdf_search.rb', line 24
def self.start_elasticsearch
`sudo service elasticsearch start`
end
|
.start_webserver(search_index) ⇒ Object
18
19
20
21
22
|
# File 'lib/pdf_search.rb', line 18
def self.start_webserver(search_index)
web_server = WebServer.new(search_index)
web_server.start
return web_server.daemon.pid.pid
end
|
.wrap_elastic_request ⇒ Object
32
33
34
35
|
# File 'lib/pdf_search.rb', line 32
def self.wrap_elastic_request
`curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'`
yield
end
|