How to search for links (nodes of type app:filelink or cm:link) in Alfresco Share?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2014 04:52 AM
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.
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,
…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-appfileli...)
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-appfileli...)
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2014 05:36 AM
I found the relevant code section:
It's in search.lib.js, where the results are filtered by
I adjusted the section and now it works. Of course this hack in the core js lib below is just for testing, the function should be overriden outside the core somehow.
It's in search.lib.js, where the results are filtered by
if (node.isContainer || node.isDocument)
I adjusted the section and now it works. Of course this hack in the core js lib below is just for testing, the function should be overriden outside the core somehow.
/** * Returns an item of the document library component. */function getDocumentItem(siteId, containerId, pathParts, node){ // PENDING: how to handle comments? the document should // be returned instead // check whether we already processed this document if (checkProcessedCache("" + node.nodeRef.toString())) { return null; } // check whether this is a valid folder or a file var item = t = null; if (node.qnamePath.indexOf(COMMENT_QNAMEPATH) == -1 && !(node.qnamePath.match(DISCUSSION_QNAMEPATH+"$") == DISCUSSION_QNAMEPATH)) { if (true || node.isContainer || node.isDocument) { item = { site: getSiteData(siteId), container: containerId, nodeRef: node.nodeRef.toString(), tags: ((t = node.tags) !== null) ? t : [], name: node.name, displayName: node.name, title: node.properties["cm:title"], description: node.properties["cm:description"], modifiedOn: node.properties["cm:modified"], modifiedByUser: node.properties["cm:modifier"], createdOn: node.properties["cm:created"], createdByUser: node.properties["cm:creator"], path: pathParts.join("/") }; item.modifiedBy = getPersonDisplayName(item.modifiedByUser); item.createdBy = getPersonDisplayName(item.createdByUser); } if (node.isContainer) { item.type = "folder"; item.size = -1; } else if (node.isDocument) { item.type = "document"; item.size = node.size; } else { // added MLN item.type = "document"; item.size = 1; } } return item;}
