cancel
Showing results for 
Search instead for 
Did you mean: 

What query needed to return direct children of cm:cmobject?

sgomez
Champ in-the-making
Champ in-the-making
Greetings,

I currently have a setup where my main object types in the repository for users are cm:folder and cm:content.  I eventually will have child nodes of these base objects for my system(e.g. cm:folder > cm:student_folder).  What would be the best way to search and return cm:folder and cm:content and their direct children?

I tried doing a lucene query TYPE:"cm:cmobject" which returned pretty much everything.  I tried PATH:"/cm:cmobject/*", which according to the search API is supposed to return the direct children of that specified object, but returned nothing to me.  Can anyone point me in the right direction on what I might need to do?  Thanks in advance!

-sgomez
4 REPLIES 4

rliu
Champ in-the-making
Champ in-the-making
TYPE:"cm:cmobject"

Try using TYPE:"cm:student_folder". That should do it.

sgomez
Champ in-the-making
Champ in-the-making
Hi rliu,

Thanks for your reply.  Unfortunately, that is not what I am trying to accomplish.  When I do a query for that, it will return to me a list of all folders that are of type cm:student_folder.  What I am trying to accomplish is to find a query that will return to me a list of all types (cm:student_folder, cm:folder, cmSmiley Tonguerof_folder, etc), though I am not sure if that's even possible…

I want to pass that list on to my web client into a dropdown menu that the user can choose from to do his/her search query.

rliu
Champ in-the-making
Champ in-the-making
Ok, no problem. Lucene syntax would require a "+",

+TYPE:"cm:student_folder"

The "+" means that it must be of this type (cm:student_folder) only. Not the parent or the child type of student folder as I originally thought you were searching for. But keep in mind, that if cm:student_folder is used anywhere in Alfresco, this Lucene search would return all nodes of cm:student_folder. If you have to localize your search to a specific path, then you want to provide that in your syntax as well.

Hope that helps.

sgomez
Champ in-the-making
Champ in-the-making
Hi rliu,

Thanks again for your reply.  Hmm, I'm not quite sure if I understand your explanation.  From what I get, it seems we are not on the same page :?  My explanation isn't the best so I apologize.  Let me go into background what I am trying to accomplish and hope that will help.  Please take a look at the image at (http://www.imgur.com/TZVNL).  It should be an image of a dropdown menu containing "cm:folder", cm:adminfolder", etc. 

What that is part of isan "Advanced Search" feature on my front end.  This advanced search UI will let the user choose what types of documents or folders to search/query for.  In this particular image, the drop down menu has a list of available folders to be used for the query (eg cm:folder will do a query TYPE:"cm:folder" while cm:studentfolder will search TYPE:"cm:studentfolder").

As of right now, that list of folder types is hard coded into the dropdown menu.  What I would like to eventually do is be able to query alfresco and it will return that list of folder types back to my front end and populate the dropdown menu.  I would need these properties to be queryable because I plan to allow the user to also create new types, which would then need to be displayed in the dropdown menu after being created.  Would that be possible?  If it helps, I am using 3.1.

Again, much thanks for your reply, and I hope my explanation is a bit more clear.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.