AnsweredAssumed Answered

How to search for links (nodes of type app:filelink or cm:link) in Alfresco Share?

Question asked by mathias.lin on Jan 9, 2014
Latest reply on Jan 9, 2014 by mathias.lin
I'm on Alfresco 4.0.2 and want to be able to search for nodes of types cm:content as well as cm:link or app:filelink.

When I look directly into the Solr index, I see that all types are indexed there. But when I search within Alfresco Share, link (nodes of type cm:link or app:filelink) are not returned, even though the search term is in their cm:name property, same as it's cm:content equivalent. I checked this in the node browser.

Both cm:content as well as cm:link have cm:cmobject as it's parent and the cm:name property is set to be indexed, which works in Solr.

Therefore, somewhere between Solr and the response returned to the client, Alfresco is doing some filtering and excluding links, I assume. I try to find the relevant code, but have not yet been successful.

I have looked at search.lib.js (/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.lib.js) and found one spot which I thought could be relevant, changed it (see out-commented line below) and reloaded the web scripts, but it still does not have the result I am looking to achieve. Still, only cm:content and cm:folder types are displayed.


  // ensure a TYPE is specified - if no add one to remove system objects from result sets
  if (ftsQuery.indexOf("TYPE:\"") === -1 && ftsQuery.indexOf("TYPE:'") === -1)
  {
     //ftsQuery += ' AND (+TYPE:"cm:content" +TYPE:"cm:folder")';
     ftsQuery += ' AND (+TYPE:"cm:content" +TYPE:"cm:folder" +TYPE:"cm:link" +TYPE:"app:filelink")';
  }


Where does Alfresco filter out certain search results, such as specific types like cm:link or app:filelink?


<strong>Update:</strong>

When I search by name through the Javascript console,


var nodes = search.luceneSearch("@name:texas");
for each(var node in nodes) {
    logger.log(node.name + " (" + node.typeShort + "): " + node.nodeRef);
}


…all types are included in the search results (in my case, three results). This is the result that I would also like to achieve through the regular Share site search. The highlighted result is the node that does not appear in the regular Alfresco Share search results:
<a href="http://i.stack.imgur.com/zDNCW.png">http://i.stack.imgur.com/zDNCW.png</a>

(http://stackoverflow.com/questions/21016521/alfresco-how-to-search-for-links-nodes-of-type-appfilelink-or-cmlink-in-alf)

Outcomes