cancel
Showing results for 
Search instead for 
Did you mean: 

get items from a defined aspect

aznk
Champ in-the-making
Champ in-the-making
Hi there,
I've defined a "taggable" aspect :
<aspect name="tag:taggable">
         <title>Taggable</title>
         <properties>
            <property name="tag:tags">
               <title>Tags</title>
               <type>d:text</type>
               <multiple>true</multiple>
            </property>
         </properties>
      </aspect>
Now I need to get all tags^, that is to say "title" from items with this given aspect.
How can I query that in Lucene ?
8 REPLIES 8

aznk
Champ in-the-making
Champ in-the-making
in other words, how do we query an custom defined aspect ? in the wiki it was only explained how to query cm stuff.

kevinr
Star Contributor
Star Contributor
It's the same as the cm queries, but you use your model URI and property name in place of the Alfresco cm model.

So this:
ASPECT:"{http://www.alfresco.org/model/content/1.0}titled"

Would change to something like this:
ASPECT:"{http://somecompany/model/tag/1.0}taggable"

Replace the 'http://somecompany/model/tag/1.0' bit with the namespace you have defined for your model.

Hope this helps,

Kevin

aznk
Champ in-the-making
Champ in-the-making
I've tried this with lucene queries but it returns me all nodes.
In fact I need to retrieve all values of nodes that have this "tagging" aspect, that is to say that we can tag any object with any number of tags, how can I retrieve all these tags ?

kevinr
Star Contributor
Star Contributor
Do you mean that you want to return nodes that have a certain value in the aspect property rather than all nodes with the aspect applied?

Thanks,

Kevin

aznk
Champ in-the-making
Champ in-the-making
I need all values of all nodes that have this aspect (not nodes but values of all these nodes).

kevinr
Star Contributor
Star Contributor
What do you mean by "value of the nodes" - nodes don't have a "value", they have various properties that have values. The lucene search can return nodes with a specific ASPECT applied as I said - but then you will need to extract the property you need from each Node result returned.

Thanks,

Kevin

aznk
Champ in-the-making
Champ in-the-making
By "value" I mean "tags", the interface enables the user to add one ore several tags. I could get all nodes with this tag aspect applied, but couldn't extract or see these "values". I'm not sure of where these values are stored but I guess in properties (maybe <type>d:text</type> child?).

aznk
Champ in-the-making
Champ in-the-making
I could get all nodes with the property tag:tags in the node browser with the selectnode option, querying for "//@tag:tags" but couldn't see the values. How can we extract all values of these properties ?