mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-12 18:38:02 +08:00
Always use Tika text extractor in server mode [SCI-6658] (#3957)
This commit is contained in:
parent
ca53c3058a
commit
ac7a6edab5
1 changed files with 7 additions and 3 deletions
|
@ -296,10 +296,14 @@ class Asset < ApplicationRecord
|
||||||
text_data = mjs_doc.search("//Field[@name='text']").collect(&:text).join(' ')
|
text_data = mjs_doc.search("//Field[@name='text']").collect(&:text).join(' ')
|
||||||
else
|
else
|
||||||
# Start Tika as a server
|
# Start Tika as a server
|
||||||
Yomu.server(:text) if !ENV['NO_TIKA_SERVER'] && Yomu.class_variable_get(:@@server_pid).nil?
|
Yomu.server(:text)
|
||||||
|
begin
|
||||||
blob.open do |tmp_file|
|
blob.open do |tmp_file|
|
||||||
text_data = Yomu.new(tmp_file.path).text
|
text_data = Yomu.new(tmp_file.path).text
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
Yomu.kill_server!
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if asset_text_datum.present?
|
if asset_text_datum.present?
|
||||||
|
|
Loading…
Reference in a new issue