AnsweredAssumed Answered

Search not finding aspect after I make updates.  NodeService.hasAspect is finding it... after updating search results

Question asked by josh_barrett on Apr 23, 2013
Latest reply on Apr 29, 2013 by josh_barrett
I am trying to write an action that creates thumbnails in the background. 
This action:
-executes a query to see what needs to be thumbnailed
-if no results exits
-iterates through the result adding thumbnails and adds a marker aspect to the node
-Sleeps for 10 seconds
-and executes query again.

I tested this with one node and it runs over and over again.  It is not finding the aspect in the query.

Here is the code (groovy):
<groovy>
     protected void processAction( String query) {
        List<NodeRef> nodeRefs = createQueue(query)
        if (nodeRefs.size() == 0) return
        transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Boolean>(){
            public Boolean execute() throws Throwable {
                for (nodeRef in nodeRefs) {
                    Action action = actionService.createAction(DermThumbnailAction.NAME)
                    actionService.executeAction(action, nodeRef)
                }
                return true;
            }
        });
        Thread.sleep(10000);
        processAction( query)
    }
</groovy>

Here is the output of my log:
2013-04-23 09:37:34,124  INFO  [alfresco.actions.DermThumbnailProcessor] [defaultAsyncAction1] Starting thumbnail process…
2013-04-23 09:37:34,130  DEBUG [alfresco.service.ADPSearchService] [defaultAsyncAction1] Getting nodes using query: TYPE:"adpp:doc" -ASPECT:"adpp:thumbnailAspect"
2013-04-23 09:37:35,484  DEBUG [alfresco.service.ADPSearchService] [defaultAsyncAction1] Search TYPE:"adpp:doc" -ASPECT:"adpp:thumbnailAspect" returned 1
2013-04-23 09:37:35,542  DEBUG [alfresco.actions.DermThumbnailAction] [defaultAsyncAction1]  Does not have a thumbnail workspace://SpacesStore/dfe35ea2-dcfb-4e30-9cad-fcb635cef523
2013-04-23 09:37:35,543  DEBUG [alfresco.service.ADPThumbnailService] [defaultAsyncAction1] Creating thumbnail for workspace://SpacesStore/dfe35ea2-dcfb-4e30-9cad-fcb635cef523
2013-04-23 09:37:36,548  INFO  [alfresco.service.ADPThumbnailService] [defaultAsyncAction1] Thumbnail created for workspace://SpacesStore/dfe35ea2-dcfb-4e30-9cad-fcb635cef523
2013-04-23 09:37:46,553  DEBUG [alfresco.service.ADPSearchService] [defaultAsyncAction1] Getting nodes using query: TYPE:"adpp:doc" -ASPECT:"adpp:thumbnailAspect"
2013-04-23 09:37:46,566  DEBUG [alfresco.service.ADPSearchService] [defaultAsyncAction1] Search TYPE:"adpp:doc" -ASPECT:"adpp:thumbnailAspect" returned 1
2013-04-23 09:37:46,569  DEBUG [alfresco.actions.DermThumbnailAction] [defaultAsyncAction1] Already has a thubmnail workspace://SpacesStore/dfe35ea2-dcfb-4e30-9cad-fcb635cef523
2013-04-23 09:37:56,570  DEBUG [alfresco.service.ADPSearchService] [defaultAsyncAction1] Getting nodes using query: TYPE:"adpp:doc" -ASPECT:"adpp:thumbnailAspect"
2013-04-23 09:37:56,579  DEBUG [alfresco.service.ADPSearchService] [defaultAsyncAction1] Search TYPE:"adpp:doc" -ASPECT:"adpp:thumbnailAspect" returned 1

…. 
Never finds the aspect via search but finds it when I do a check for the aspect before adding the thumbnail.  I must be doing something wrong.


Outcomes