G’day Josh,

One thing to watch out for with Alfresco is that query is “eventually 
consistent” - indexing of new / updated content is done asynchronously and 
those indexes are used by the query engine.  As of Alfresco 4.2 there’s a 
metadata query 
capability<http://wiki.alfresco.com/wiki/Alfresco_Community_4.2#Metadata_Query> 
[1] that can be enabled to allow some (but not all) queries to be run in a 
transactionally consistent fashion, although note that the query below doesn’t 
meet the requirements to be executed as a metadata query (due to the LIKE and 
IN_TREE clauses).

That said, if this were indeed Alfresco’s eventually consistent behaviour I 
would expect both your client application and the CMIS Workbench to exhibit the 
same (or similar) results.  The indexes are a global resource, so it’s 
difficult to imagine a case where the two clients would continue to return 
inconsistent results for a lengthy period of time (unless, of course, you’re 
authenticated as different users - then it could be explained by ACLs).

At this point it’s hard to tell where the issue might lie (OpenCMIS vs custom 
code vs CMIS Workbench vs Alfresco server), so I’ve cc’ed the 
alfresco-technical-discussion google group - hopefully between the two groups 
we’ll be able to narrow down the possibilities.

Cheers,
Peter

[1] http://wiki.alfresco.com/wiki/Alfresco_Community_4.2#Metadata_Query


On 2014-08-11, at 9:13 AM, Joshy Augustine 
<joshymaugust...@gmail.com<mailto:joshymaugust...@gmail.com>> wrote:

Hi All,

I am a newbie to Open CMIS. I am very fascinated by Open CMIS framework
that allowed me to write(almost in no time) a sample test program that
interacts with a various ECM Vendors. However, I am encountering a strange
issue with Alfresco and wondered whether any of you had the time to help?

In the sample code I am developing, I perform the following actions

1) Create a Folder in Alfresco
2) Add  a few documents to it
3) Search (via CMIS Query) for the list of documents in a folder tree that
matches with search criteria.

In step 3, I execute the following API


ItemIterable<QueryResult> queryResult = session.query(complete_statement,
*false*,operationContext);

Iterator<QueryResult> iterator = queryResult.iterator();

*while* (iterator.hasNext())

{

QueryResult qr = (QueryResult) iterator.next();

String id = (String) qr.getPropertyByQueryName("cmis:objectId"
).getFirstValue());

}

that results in the following query being executed.

*SELECT cmis:objectId FROM cmis:document WHERE cmis:name like 'Hello Wor%'
AND IN_TREE('c4714b61-2800-4995-8e37-2cc07549d4b2') ORDER BY
cmis:creationDate desc*
When I run the test program, most of the times, this query does not return
any results. If i put a breakpoint in the line session.query() and execute
the statement using CMIS Workbench, I am able to find results.
Sometimes(but not always) even putting a Thread.sleep() before
session.query() allows me to find the documents that query should have
found.


Any idea what is the best way to debug this issue?


Cheers,
Josh

Reply via email to