我正在努力提高我们的一个实现的性能,
我们目前使用 Alfresco nodeService.getChildAssocs 从 rootNode 检索节点并运行某种循环来比较路径。
当您有大量文件时,这不是很有效。我已经从 Share 调试了定位文件 web 脚本,发现它们根据路径运行 Lucene 查询。
这也是此处描述的内容:http://wiki.alfresco.com/wiki/NodeRef_cookbook#Getting_a_NodeRef_from_its_path
这是检索 NodeRef 的最有效方法吗?是否有另一个 API 可用于从存储库端(Java 中)运行这个简单的任务?
非常感谢
最佳答案
在基础 API 中,您可以 call :
FileFolderService.resolveNamePath(NodeRef rootNode, List pathElements)
FileFolderService.resolveNamePath(NodeRef rootNode, List pathElements, Boolean mustExist)
Internally ,它使用搜索循环模式,可能类似于您提到的您已经在做的事情。然后,如果您只想进行搜索,您可以使用其他 API:
SearchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_XPATH, "/app:company_home/cm:path/cm:to/cm:content")
OOTB 远程 API 是 org/alfresco/cmis/item.get
Web 脚本,它提供以下 URL 模板等:
/cmis/s/{store}/arg/p?path={path}&filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}
/api/path/{store_type}/{store_id}/{nodepath}?filter={filter?}&returnVersion={returnVersion?}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&includeACL={includeACL?}&renditionFilter={renditionFilter?}
不过,我不建议将其用于性能关键路径,因为 CMIS 非常繁琐。我可能会开发一个利用上述基础 API 的自定义 Web 脚本。
关于alfresco - 在露天 : Fastest way to get NodeRef from a node path,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9989846/