cancel
Showing results for 
Search instead for 
Did you mean: 

NXQL filtering out deleted documents

sstodghill_
Champ on-the-rise
Champ on-the-rise

Hi,

I have the NXQL query below being executed via Resultset.PageProvider REST call

{ "params": {  "pageSize" : 100,  "query" :  "SELECT ecm:uuid, dc:title, ecm:primaryType, ecm:isLatestVersion, ecm:isCheckedInVersion, ecm:versionVersionableId, ecm:currentLifeCycleState, file:content/mime-type FROM Picture " } }

If the document has been edited then an object is returned for each version. Adding

where ecm:isLatestVersion = 1 or ecm:isLatestVersion is null

returns the latest version and the deleted version and the versions can be linked by matching the deleted version's ecm:uuid property with the non-deleted ecm:versionVersionableId but it seems error prone and is not documented.

Can an NXQL query be structured so documents in a deleted state are not returned without client-side post-processing?

Thanks in advance.

1 ACCEPTED ANSWER

Florent_Guillau
World-Class Innovator
World-Class Innovator

Try using ecm:isVersion = 0 (or the more verbose ecm:isCheckedInVersion = 0 before Nuxeo 5.8) to only get the "live" document, instead of ecm:isLatestVersion which deals with versions

View answer in original post

4 REPLIES 4

Thierry_Martins
Star Collaborator
Star Collaborator

hello,

you need to add this clause to filter deleted documents:

ecm:currentLifeCycleState != 'deleted'

Thierry

Thanks, I tried that but it still returns an entry for the version that was not deleted. The query results without the ecm

Florent_Guillau
World-Class Innovator
World-Class Innovator

Try using ecm:isVersion = 0 (or the more verbose ecm:isCheckedInVersion = 0 before Nuxeo 5.8) to only get the "live" document, instead of ecm:isLatestVersion which deals with versions

This tested successfully versioning documents and not versioning them and it getting the expected results. Thanks, Florent!