AnsweredAssumed Answered

Trouble querying node properties

Question asked by dwinfield on Sep 23, 2009
Latest reply on Sep 29, 2009 by dwinfield
Hi all,

I'm having trouble querying for the "url" values of the links.  I wanted to do two things, get a distinct list, and filter links based on the url. 

Looking at http://wiki.alfresco.com/wiki/Search_Documentation#Examples I found some queries that sort of did what I want.  So I modified it and got this query
"//.[@lnk:url='*']"

Unfortunately I get nothing back.

Full code I'm using

      DynamicNamespacePrefixResolver namespacePrefixResolver = new DynamicNamespacePrefixResolver(null);
      namespacePrefixResolver.registerNamespace(NamespaceService.ALFRESCO_PREFIX, NamespaceService.ALFRESCO_URI);
      namespacePrefixResolver.registerNamespace("lnk", "http://www.alfresco.org/model/linksmodel/1.0");
      
      
      List<Serializable> rs = this.searchService.selectProperties(original, "*//.[@lnk:url]", null, namespacePrefixResolver, true);

the variable "original" is either the links folder in the site OR it's an actual link I had created in the site.  I wasn't sure if this code had to be run on the folder or the link, so I tried both.

For the filter, I would change the Xpath query to "*//.[@lnk:url=<WHATEVER_IS_ PASSED_IN>]"
I got the registration for the uri and prefix by looking at Repository/config/alfresco/model/linksModel.xml

Anyone with any ideas?

Outcomes