简体   繁体   English

Alfresco:如何在Alfresco Share中搜索链接(类型为app:nodelink或cm:link的节点)?

[英]Alfresco: how to search for links (nodes of type app:filelink or cm:link) in Alfresco Share?

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 . 我在Alfresco 4.0.2上,希望能够搜索类型为 cm的节点 :内容以及cm:link或app:filelink

When I look directly into the Solr index, I see that all types are indexed there. 当我直接查看Solr索引时,我发现所有类型都在那里被索引。 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. 但是当我在Alfresco Share中搜索时,即使搜索项位于cm:name属性中,也不会返回链接(cm:node或app:filelink类型的节点),与cm的cm:内容相同。 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. cm:content和cm:link都有cm:cmobject作为父级,cm:name属性设置为索引,在Solr中有效。

Therefore, somewhere between Solr and the response returned to the client, Alfresco is doing some filtering and excluding links, I assume. 因此,在Solr和返回给客户端的响应之间,Alfresco正在进行一些过滤并排除链接,我假设。 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. 我查看了search.lib.js (/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.lib.js)并发现了一个我认为可能的地方相关的,改变它(见下面的注释后的行)并重新加载了Web脚本,但它仍然没有我想要实现的结果。 Still, only cm:content and cm:folder types are displayed. 但仍然只显示cm:content和cm:文件夹类型。

  // 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? Alfresco在哪里筛选出某些搜索结果,例如特定类型?

Update: 更新:

在此输入图像描述

when I search by name through the Javascript console, all types are included in the search results (in my case, three results). 当我通过Javascript控制台按名称搜索时,所有类型都包含在搜索结果中(在我的例子中,有三个结果)。 This is the result that I would also like to achieve through the regular Share site search. 这是我希望通过常规的Share网站搜索实现的结果。 The highlighted result is the node that does not appear in the regular Alfresco Share search results. 突出显示的结果是未出现在常规Alfresco Share搜索结果中的节点。

I found the relevant code section: 我找到了相关的代码部分:

It's indeed in search.lib.js , but in a different method getDocumentItem further down the processing chain, where the results are filtered by 它确实在search.lib.js中 ,但在另一个方法getDocumentItem进一步向下处理链,其中结果被过滤

  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. 当然,下面的核心js lib中的这个hack只是用于测试,该函数应该以某种方式在核心之外覆盖。

/**
 * 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;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM