I've got several web scripts that take some parameters, perform a search & return the results as JSON. The Java code looks like this at a high level:
1. Construct AFTS query from params
2. Perform search using SearchService to return a collection of node refs
3. Iterate search results, calling NodeService#getProperties for each node ref, and build up the response data.
This sppears to be very inefficient as you need to make multiple calls to the search engine. I was thinking that surely there's got to be a better way. i.e. can we retrieve the metadata in a single query to the DB? e.g. SELECT col1, col2, col3 FROM table1 WHERE...
I then remembered that Alfresco supports CMIS. So it should be possible to run CMIS SQL queries? I ran some queries in Alfresco Admin's Node Browser and while they worked, it didn't render the individual columns. However I've read that this behaviour is possible using Chemistry's workbench. Is it possible use the SearchService to return a ResultSet that contains metadata/columns rather than node refs. If so, could you point me towards a code example as I've not been able to find one.
In my experience CMIS is slower endpoint than REST, and as a standard it does not provide the full functionality that Alfresco provides with the REST API. Although you interact with Alfresco CMIS Server endpoint, the typical actions are going to require a lot of CMIS connections.
CMIS SQL has a lot of limitations , it is not standard SQL and some many queries are NOT possible. But you can check syntax and example using CMIS Workbench with Alfresco.
Regarding to the question, you can query with CMIS SQL, get a resultset with properties.