<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic NXQL query for retrieving document versions, filtered by parent id in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/nxql-query-for-retrieving-document-versions-filtered-by-parent/m-p/327805#M14806</link>
    <description>&lt;P&gt;Hello,
I'm currently trying to retrieve all the versions of a document using a NXQL query, filtering them by their parent id.&lt;/P&gt;
&lt;P&gt;Here is my current NXQL query :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM MyDocumentType 
  WHERE ecm:parentId = '63ab5b87-6e28-4deb-929b-5b5259bcc143'
  AND ecm:currentLifeCycleState &amp;lt;&amp;gt; 'deleted'
  AND MySchema:myattribute = 'my-value'
  AND ecm:isVersion = 1
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This query returns no document (using curl) :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{
   "totalSize" : 0,
   "entity-type" : "documents",
   "currentPageSize" : 0,
   "numberOfPages" : 1,
   "isLastPageAvailable" : false,
   "isNextPageAvailable" : false,
   "maxPageSize" : 1000,
   "isPaginable" : true,
   "entries" : [],
   "isSortable" : true,
   "errorMessage" : null,
   "currentPageIndex" : 0,
   "hasError" : false,
   "pageCount" : 1,
   "pageSize" : 0,
   "pageIndex" : 0,
   "resultsCount" : 0,
   "isPreviousPageAvailable" : false
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is weird, because when I execute the same query without the &lt;CODE&gt;ecm:parentId&lt;/CODE&gt; statement, the document versions are returned :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{
   "pageSize" : 0,
   "isSortable" : true,
   "entries" : [
      {
         "changeToken" : "1462376077045",
         "entity-type" : "document",
         "path" : "/my_path/title-1234",
         "uid" : "48a6196a-2fd9-470d-8fa5-c899a344276b",
         "title" : "title-1234",
         "state" : "project",
         "parentRef" : "63ab5b87-6e28-4deb-929b-5b5259bcc143",
         "lastModified" : "2016-05-04T15:34:37.04Z",
         "type" : "MyDocumentType",
         "isCheckedOut" : false,
         "facets" : [
            "Immutable",
            "Versionable",
            "Publishable",
            "Commentable",
            "HasRelatedText",
            "Thumbnail"
         ],
         "repository" : "default"
      },
      {
         "path" : "/my_path/title-1234",
         "changeToken" : "1462785279786",
         "entity-type" : "document",
         "parentRef" : "63ab5b87-6e28-4deb-929b-5b5259bcc143",
         "lastModified" : "2016-05-09T09:14:39.78Z",
         "state" : "project",
         "title" : "title-1234",
         "uid" : "7cbbf41d-bb33-4b4a-971c-b2d4a5cd599c",
         "type" : "MyDocumentType",
         "isCheckedOut" : false,
         "repository" : "default",
         "facets" : [
            "Immutable",
            "Versionable",
            "Publishable",
            "Commentable",
            "HasRelatedText",
            "Thumbnail"
         ]
      }
],
   "isPreviousPageAvailable" : false,
   "currentPageIndex" : 0,
   "isNextPageAvailable" : false,
   "pageIndex" : 0,
   "isPaginable" : true,
   "resultsCount" : 2,
   "totalSize" : 2,
   "currentPageSize" : 2,
   "hasError" : false,
   "entity-type" : "documents",
   "errorMessage" : null,
   "pageCount" : 1,
   "maxPageSize" : 1000,
   "numberOfPages" : 1,
   "isLastPageAvailable" : false
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For information my document versions have been created using the &lt;CODE&gt;Document.CheckIn&lt;/CODE&gt;operation with the parameter &lt;CODE&gt;version&lt;/CODE&gt; set to &lt;CODE&gt;major&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;I have probably misunderstood how the document versioning works, or how NXQL works, that's why I'm asking for some help!&lt;/P&gt;
&lt;P&gt;If you need more informations, feel free to ask me.&lt;/P&gt;
&lt;P&gt;Thanks!
&lt;EM&gt;Kevin.&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 12 May 2016 09:35:26 GMT</pubDate>
    <dc:creator>kfrapin_</dc:creator>
    <dc:date>2016-05-12T09:35:26Z</dc:date>
    <item>
      <title>NXQL query for retrieving document versions, filtered by parent id</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nxql-query-for-retrieving-document-versions-filtered-by-parent/m-p/327805#M14806</link>
      <description>&lt;P&gt;Hello,
I'm currently trying to retrieve all the versions of a document using a NXQL query, filtering them by their parent id.&lt;/P&gt;
&lt;P&gt;Here is my current NXQL query :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM MyDocumentType 
  WHERE ecm:parentId = '63ab5b87-6e28-4deb-929b-5b5259bcc143'
  AND ecm:currentLifeCycleState &amp;lt;&amp;gt; 'deleted'
  AND MySchema:myattribute = 'my-value'
  AND ecm:isVersion = 1
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This query returns no document (using curl) :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{
   "totalSize" : 0,
   "entity-type" : "documents",
   "currentPageSize" : 0,
   "numberOfPages" : 1,
   "isLastPageAvailable" : false,
   "isNextPageAvailable" : false,
   "maxPageSize" : 1000,
   "isPaginable" : true,
   "entries" : [],
   "isSortable" : true,
   "errorMessage" : null,
   "currentPageIndex" : 0,
   "hasError" : false,
   "pageCount" : 1,
   "pageSize" : 0,
   "pageIndex" : 0,
   "resultsCount" : 0,
   "isPreviousPageAvailable" : false
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is weird, because when I execute the same query without the &lt;CODE&gt;ecm:parentId&lt;/CODE&gt; statement, the document versions are returned :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{
   "pageSize" : 0,
   "isSortable" : true,
   "entries" : [
      {
         "changeToken" : "1462376077045",
         "entity-type" : "document",
         "path" : "/my_path/title-1234",
         "uid" : "48a6196a-2fd9-470d-8fa5-c899a344276b",
         "title" : "title-1234",
         "state" : "project",
         "parentRef" : "63ab5b87-6e28-4deb-929b-5b5259bcc143",
         "lastModified" : "2016-05-04T15:34:37.04Z",
         "type" : "MyDocumentType",
         "isCheckedOut" : false,
         "facets" : [
            "Immutable",
            "Versionable",
            "Publishable",
            "Commentable",
            "HasRelatedText",
            "Thumbnail"
         ],
         "repository" : "default"
      },
      {
         "path" : "/my_path/title-1234",
         "changeToken" : "1462785279786",
         "entity-type" : "document",
         "parentRef" : "63ab5b87-6e28-4deb-929b-5b5259bcc143",
         "lastModified" : "2016-05-09T09:14:39.78Z",
         "state" : "project",
         "title" : "title-1234",
         "uid" : "7cbbf41d-bb33-4b4a-971c-b2d4a5cd599c",
         "type" : "MyDocumentType",
         "isCheckedOut" : false,
         "repository" : "default",
         "facets" : [
            "Immutable",
            "Versionable",
            "Publishable",
            "Commentable",
            "HasRelatedText",
            "Thumbnail"
         ]
      }
],
   "isPreviousPageAvailable" : false,
   "currentPageIndex" : 0,
   "isNextPageAvailable" : false,
   "pageIndex" : 0,
   "isPaginable" : true,
   "resultsCount" : 2,
   "totalSize" : 2,
   "currentPageSize" : 2,
   "hasError" : false,
   "entity-type" : "documents",
   "errorMessage" : null,
   "pageCount" : 1,
   "maxPageSize" : 1000,
   "numberOfPages" : 1,
   "isLastPageAvailable" : false
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For information my document versions have been created using the &lt;CODE&gt;Document.CheckIn&lt;/CODE&gt;operation with the parameter &lt;CODE&gt;version&lt;/CODE&gt; set to &lt;CODE&gt;major&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;I have probably misunderstood how the document versioning works, or how NXQL works, that's why I'm asking for some help!&lt;/P&gt;
&lt;P&gt;If you need more informations, feel free to ask me.&lt;/P&gt;
&lt;P&gt;Thanks!
&lt;EM&gt;Kevin.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 09:35:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nxql-query-for-retrieving-document-versions-filtered-by-parent/m-p/327805#M14806</guid>
      <dc:creator>kfrapin_</dc:creator>
      <dc:date>2016-05-12T09:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: NXQL query for retrieving document versions, filtered by parent id</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nxql-query-for-retrieving-document-versions-filtered-by-parent/m-p/327806#M14807</link>
      <description>&lt;P&gt;Versions's path returned by &lt;CODE&gt;ver.getPathAsString()&lt;/CODE&gt; are really a pseudo-path (and a historical remnant), but in the actual storage and in what NXQL sees, versions have no parent. You can identify the versions of a given live document using their &lt;CODE&gt;ecm:versionVersionableId&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 09:39:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nxql-query-for-retrieving-document-versions-filtered-by-parent/m-p/327806#M14807</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2016-05-12T09:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: NXQL query for retrieving document versions, filtered by parent id</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nxql-query-for-retrieving-document-versions-filtered-by-parent/m-p/327807#M14808</link>
      <description>&lt;P&gt;Thanks a lot Florent. It works.&lt;/P&gt;
&lt;P&gt;Now I proceed with two different queries.&lt;/P&gt;
&lt;P&gt;The first query (retrieving the live document) :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM MyDocumentType
  WHERE ecm:parentId = '63ab5b87-6e28-4deb-929b-5b5259bcc143'
  AND ecm:currentLifeCycleState &amp;lt;&amp;gt; 'deleted'
  AND MySchema:myattribute = 'my-value'
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The second query (retrieving all the versions of the found document) :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM MyDocumentType
  WHERE ecm:versionVersionableId = '&amp;lt;live-document-id-found-with-first-query&amp;gt;' 
  AND ecm:currentLifeCycleState &amp;lt;&amp;gt; 'deleted'
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 May 2016 11:29:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nxql-query-for-retrieving-document-versions-filtered-by-parent/m-p/327807#M14808</guid>
      <dc:creator>kfrapin_</dc:creator>
      <dc:date>2016-05-12T11:29:10Z</dc:date>
    </item>
  </channel>
</rss>

