cancel
Showing results for 
Search instead for 
Did you mean: 

NQXL workspace query

olaf_
Champ on-the-rise
Champ on-the-rise

I am programming using the REST API and NXQL. I ran into some problems and found it easier to test queries first using Nuxeo Shell : Nuxeo Shell in batch mode My goal is to have a listing of items found in a workspace or folder. I tried the following queries:

  1. query "SELECT * FROM Document WHERE ecm:path = '/default-domain/workspaces/Trial workspace'"
  2. query "SELECT * FROM Document WHERE ecm:path = '/default-domain/workspaces/Trial workspace/'"
  3. query "SELECT * FROM Document WHERE ecm:path = '/default-domain/workspaces/Trial workspace/*'"
  4. query "SELECT * FROM Document WHERE ecm:path STARTSWITH '/default-domain/workspaces/Trial workspace'"

These result in either no listing, a single item being the name of the path itself or the entire contents of the workspace including all items in subfolders, workspaces, etc which is way too much.

I also experimented a bit based on Existing Document Types (Dublin Core) and of course NXQL specification, but never got the result I wanted.

Basically I would like to have the same thing as you would have when using the Nuxeo GUI: a view of items in a folder, workspace, collection or section and not something residing in parent or child branches/items.

Q: How do I get what I want please?

8 REPLIES 8

pibou_Bouvret
Elite Collaborator
Elite Collaborator

It might be easier to use either the children adapter : "/path/{docPath}/@children" or the Document.GetChild operation

Using NXQL, you should take a look at "ecm:parentId"

In NXQL also look at the `ecm

I think Olaf is looking for children not descendants (he mentionned the ecm

Indeed, sorry I misread. `ecm

https

Thank you both for your prompt replies. Actually I am looking the exact contents and not a parent or child/descendant. So NXP-19605 seems to offer exactly what I want/need(ed) except that I was looking at the item itself and not the parent. But as it works it works regardless of the name

olaf_
Champ on-the-rise
Champ on-the-rise

In Nuxeo shell I get a huge resultset when executing the query:

query "SELECT * FROM Document WHERE ecm:path STARTSWITH '/default-domain/workspaces/Trial workspace'"

However when I execute the same query using the PHP lib/client I get an exception 0 : File not found. And as a side effect an empty resultset. Is this a bug?

My goals was to get the first item of the resultset and then get the parentID so I can follow up the suggestions of Florent Guillaume in this thread, I assume this is the way to go as there is no LIMIT function or a way to query a workspace's properties directly?

olaf_
Champ on-the-rise
Champ on-the-rise

Recently I noted something which does not sound logical to me:

query "SELECT * FROM Workspace WHERE ecm:path = '/default-domain/workspaces/Trial workspace'"

produces an exception and an empty resultset. Whereas:

query "SELECT * FROM Section WHERE ecm:path = '/default-domain/sections/just another section'"

produces a single item resultset. In other words: properties of a section can be easily queried and therefor the ID can be retrieved. The ID can then be used to get the contents of the section. But the same can not be said for a workspace. Is this intentional?