Always use Tika text extractor in server mode [SCI-6658] (#3957)

This commit is contained in:
Alex Kriuchykhin 2022-03-30 14:08:36 +02:00 committed by GitHub
parent ca53c3058a
commit ac7a6edab5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -296,10 +296,14 @@ class Asset < ApplicationRecord
text_data = mjs_doc.search("//Field[@name='text']").collect(&:text).join(' ')
else
# 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|
text_data = Yomu.new(tmp_file.path).text
end
ensure
Yomu.kill_server!
end
end
if asset_text_datum.present?