Dealing with Alfresco Version 3.3 -
In my JavaScript program within the Alfresco Repository, I am attempting to delete all archived files similar to Windows' Recycle Bin. However, I have encountered an issue where the Lucene search only retrieves 1000 nodes at a time. To work around this limitation, I have tried deleting the initial results and running the search again in hopes of fetching more nodes up to the point of no search results. Despite waiting for Lucene to re-index after each deletion for as long as five minutes, the subsequent searches still return the same set of 1000 nodes, leading me to believe there might be some caching or transactional behavior at play.
Has anyone else faced this challenge? Is there a way to ensure that the search fetches fresh results on repeated executions within the same JavaScript process?
Below is a snippet demonstrating an attempt to delete 2000 nodes:
var query = 'ASPECT:"sys:archived"';
var results = search.luceneSearch('archive://SpacesStore/',query);
for(var i=0;i<results.length;i++){
if(search.findNode(results[i].nodeRef)!=null){
results[i].remove();
}
}
results = search.luceneSearch('archive://SpacesStore/',query);
for(var i=0;i<results.length;i++){
if(search.findNode(results[i].nodeRef)!=null){
results[i].remove();
}
}