09-09-2021 07:57 AM
In any version of Alfresco ACS, when I try to run a rule to a folder that has let's say, 2k files, it always fails... As if it timed out.
I can't seem to figure out, how can I apply a rule to many files, without failing just because the big number of files?
Thank you all.
09-09-2021 08:08 AM
Hi!
Why don't you use Bulk Import tool? For such amount of documents is highly recommended.
Cheers,
Cristina.
09-09-2021 08:28 AM
Thank you,
But I was actually trying to run the rule for files that are already on the ECM.
09-09-2021 09:40 AM
@iohann95 wrote:
In any version of Alfresco ACS, when I try to run a rule to a folder that has let's say, 2k files, it always fails... As if it timed out.
I can't seem to figure out, how can I apply a rule to many files, without failing just because the big number of files?
Thank you all.
Not a good idea to run rule on 2k nodes, However what error you see in logs (alfresco.log, share.log, catalina.out)?
I would rather suggest to use java behaviors and process the nodes in batches.
09-09-2021 09:55 AM
Thank you very much for the answer. I will try to check the logs, but probably won't help since this behavior is present from the older to newer alfresco version.
Am I basically out of luck then... I will have to figure out develop something, correct?
I was actually trying to run the Extract common metadata fields rule to those files.
09-09-2021 10:35 AM
You can develop a javascript where you can limit the number of document to process. For those they process, you can apply an aspect (empty), just to mark them. So next time, you can add a check, if the script get a file with that aspect, just exit it and continue with next one.
Something like that.
I had develop long time ago a script where you give a folder_name and it was creating the preview for those files they don't have it yet. Maybe you can reuse part of it. You need to save the script in Data Dictionay/Scripts
/** * Author: CristinaMR * Date: 22/12/11 * url to launch it: http://[HOST]:[PORT]/alfresco/command/script/execute?scriptPath=/Company%20Home/Data%20Dictionary/Scripts/GeneraPreviewsFinal.js&q=10 **/ var counter=0;
//Log config var logmessage="[INFO] "; var errmessage="[ERROR] ";
// space to loop var espacio = companyhome.childByNamePath("folder_name");
//Get number from URL var max=args.q;
//Log config var logfile = espacio.childByNamePath( "ThumbnailsLog.txt" ); if ( logfile == null ) logfile = espacio.createFile( "ThumbnailsLog.txt" ); logfile.content = "############### LOG ############### \n"; logfile.content += logmessage + "Content to update: "+max.toString() +"\n \n \n";
//main function recorre(espacio); function recorre(n) { var srchQuery = "+TYPE:\"cm:content\" -ASPECT:\"{http://www.alfresco.org/model/content/1.0}taggable\""; var def = { query: srchQuery, store: "workspace://SpacesStore", language: "lucene", page: {maxItems:max} }; var n = search.query(def); logfile.content += logmessage + "Documents to process: "+ max +" & docs loaded: "+ n.length + "\n"; if (n.length>0){ for (var i=0; i<max; i++) { logfile.content += logmessage + "Counter: "+counter +"\n"; var thumbnails = n[i].getThumbnails(); if ((thumbnails == null || thumbnails.length == 0)&& !n[i].hasAspect("cm:taggable")){ creaThumbnail(n[i]); } } }else{ logfile.content += logmessage + "No doc to update. \n"; } }
//function to create the thumbnail function creaThumbnail(node){ try{ //logfile.content += logmessage + "First step to thumbnail function in " + node.name +"\n"; node.addAspect("cm:taggable"); node.createThumbnail("webpreview", true); counter++; node.addTag("Actualizado"); node.save(); logfile.content += logmessage + "Updated: "+ node.name +"\n"; }catch(e){ logfile.content += errmessage + "Failed to update node: "+node.name +"\n"; } } //Log properties logfile.content += logmessage + "Total files updated: "+counter.toString() +"\n \n \n"; logfile.properties.encoding = "UTF-8"; logfile.properties.mimetype = "text/plain"; logfile.properties.title = "Log Preview"; logfile.properties.description = "Update log file"; logfile.save();
Cris.
09-13-2021 07:49 AM
Thanks, I will have a look.
Explore our Alfresco products with the links below. Use labels to filter content by product module.