From ac7a6edab5fa62785332ad589944df292793da04 Mon Sep 17 00:00:00 2001 From: Alex Kriuchykhin Date: Wed, 30 Mar 2022 14:08:36 +0200 Subject: [PATCH] Always use Tika text extractor in server mode [SCI-6658] (#3957) --- app/models/asset.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/models/asset.rb b/app/models/asset.rb index 432c4a2ce..a20c434a2 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -296,9 +296,13 @@ 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? - blob.open do |tmp_file| - text_data = Yomu.new(tmp_file.path).text + Yomu.server(:text) + begin + blob.open do |tmp_file| + text_data = Yomu.new(tmp_file.path).text + end + ensure + Yomu.kill_server! end end