cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Webscript to Dynamically populate the nodes!

bilalsaeed
Confirmed Champ
Confirmed Champ

I have a JS based webscript to upload the file to Alfresco and another webscript to retrieve all the uploaded files. Basically once user upload the file I redirect user to file retrieval WS. Even if the file has been successfully uploaded to the Alfresco yet my document retrieval WS needed to be refresh again and again till the uploaded file appears.

In my existing doc retieval WS I am using lucene search to retrieve the nodes from a particular directory:

nodes=search.luceneSearch("PATH:\"/app:company_home/st:sites/cm:"+siteName+"/cm:documentLibrary/cm:"+folder+"/*\" ");

Any suggestions which file should be modified to achieve dynamic node population, either .js file(use any other node retrieval method) or .ftl file(asyn calls to WS until the new data is populated)?

6 REPLIES 6

douglascrp
World-Class Innovator
World-Class Innovator

I believe the problem you are facing with is what is called Eventual consistency | Alfresco Documentation 

As you have just created the content, it will take some time to have it indexed by solr, and because of that, you will have to wait until you see the object in the query response.

Well I think this is the case, how can I overcome? Do I need to retrieve the nodes by nodescript api instead of search?

douglascrp
World-Class Innovator
World-Class Innovator

This blog post will give you some useful information

Alfresco’s Transactional Metadata Query System – Mystery Results 

First off thanks bro!

As per aforementioned article "CONTAINS" isn't supported by Transactional Metadata Queries. But I need to use it since my query retrieve nodes based on path. Any suggestion?

douglascrp
World-Class Innovator
World-Class Innovator

Can you share the query you are executing?

And if possible, post here a example of the folder structure you are creating.

currentSearch="PATH:\"/app:company_home/st:sites/cm:"+siteName+"/cm:documentLibrary/cm:"+folder;

I take a parameter in my url lets say path=docket01-myFolder01-New1 on the basis of "-" I split the parameter and each separated string represent a folder. So in this case I need to show all the files and folders inside "New1". I did it by traversing to folders using childByNamePath and updates my lucene search query

currentSearch+="/cm:"+subFolder;

nodes = search.luceneSearch(currentSearch);