AnsweredAssumed Answered

Retrieving categorynode using lucene search

Question asked by unknown-user on May 12, 2010
Hi,

Is this possible?

So far I have had no luck accomplishing this…

var tags = search.luceneSearch("+@cm\\:name:\"TestTag\" AND TYPE:\"cm:category\"");
tags[0].isCategory // returns false, although it should return true….

The methods/properties for the CategoryNode defined in the following document are all undefined when the code executes.
http://wiki.alfresco.com/wiki/3.0_JavaScript_API#Classification_API

I read this post http://forums.alfresco.com/en/viewtopic.php?f=3&t=9023, and I am wondering if this might be related to my problem.  The post outlines that there is a problem with "Search are not correctly coerced into Category node object type". 

However, when I do the following, I am able to use the methods and properties of the CategoryNode.


var root_cats =  classification.getRootCategories("cm:generalclassifiable");
var cat = root_cats[0];
ret.push("Length: " + cat.membersAndSubCategories);

But, I need a specific tag, and I'd rather not loop through to find the CategoryNode, rather I'd prefer to do a luceneSearch to get a handle of the tag.  If worse comes to worse, this will be my option.

Outcomes