diff --git a/app/services/search_service/model.rb b/app/services/search_service/model.rb
index cd2babadff2f2706b1263b6badc690b53e999927..6c134c09d048603e75a00b05faf825d5cf019442 100644
--- a/app/services/search_service/model.rb
+++ b/app/services/search_service/model.rb
@@ -71,14 +71,14 @@ module SearchService
       }
       return match_all_query if @search.query == '*'
 
-      {   
+      {
         query:{
           function_score: {
             query: { bool: {
               must: { dis_max: { queries: mount_queries } },
               filter: mount_filter
             } },
-            functions: [{ script_score: { script: { lang: 'groovy', file: 'calculate_score' } } }]
+            functions: [{ script_score: { script: { lang: 'painless', file: 'calculate_score' } } }]
           }
         },
         # https://www.elastic.co/guide/en/elasticsearch/guide/current/pagination.html
diff --git a/app/workers/attachment_cache_worker.rb b/app/workers/attachment_cache_worker.rb
index 5333d5acc83581a4d7c94aef0d6a3cdd5446f459..b5ac3c5bf149508f4174c33928a060d5b13c4c0d 100644
--- a/app/workers/attachment_cache_worker.rb
+++ b/app/workers/attachment_cache_worker.rb
@@ -37,7 +37,7 @@ class AttachmentCacheWorker
       FileUtils.mkdir_p(directory_root)
       FileUtils.mv(file.path, file_root)
       FileUtils.chmod 0644, file_root.to_s, verbose: true
-      FileUtils.chown_R 'portalmec', 'www-data', directory_root.to_s, verbose: true
+      FileUtils.chown_R 'portalmec', 'portalmec', directory_root.to_s, verbose: true
       @attachment.update(cache_link: cache_link)
     ensure
       file.close if !file.nil? && File.exist?(file.path)