A brief post on the CMIS4DAM technical committee is up on the Alfresco blog.
Inconsistent CMIS Query Results? It’s not You, It’s your Locale.
A simple CMIS query like:
SELECT D.* FROM cmis:document AS D WHERE D.cmis:name LIKE '%Flower%' OR D.cmis:contentStreamFileName LIKE '%Flower%'
was giving me a fit lately, not working at all in RightsPro‘s CMIS plugin which uses OpenCMIS and yielding inconsistent results in CMIS Workbench where re-posting the same query ten times would give the expected result maybe half the time.
Thanks to Florian Müller and this post, it seems as though Alfresco doesn’t always behave as expected when the locale is set in the CMIS session.
Removing the locale session parameters got things working in RightsPro, but I didn’t immediately see an easy way to change the locale in a Workbench session (the log shows that it’s using a default of
en_US), and I still don’t know what’s up with the inconsistent results there, perhaps a coincidental caching issue.
This was all using OpenCMIS 0.3 against Alfresco Enterprise 3.3.1 over SSL.
Searching Custom Aspects via CMIS
I didn’t immediately see any simple, working examples of how to search custom aspect properties via CMIS so I’ll post a brief one here.
In this example we’re using a CMIS query to search for the IPTC caption property provided by the IPTC/EXIF project. After installing that module the properties are applied using an aspect which is defined in
Within that file you’ll see:
<aspects> <aspect name="iptc:iptc">
In our case the target Alfresco repository is running enterprise 3.3.1 and aspects are implemented via JOIN syntax as very briefly stated in the wiki.
So the resulting query for this particular search of the IPTC caption field ends up looking like:
SELECT D.*, IPTC.* FROM cmis:document AS D JOIN iptc:iptc AS IPTC ON D.cmis:objectId = IPTC.cmis:objectId WHERE IPTC.iptc:caption LIKE '%searchTerm%'
There were big changes in Alfresco 3.4 in terms of metadata extraction and I haven’t yet had a chance to update the forge projects (or determine if they’re still even needed) and there are proposals for aspects in the next CMIS spec so I’ll be back to update this post.