You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用Lucene Query查询Alfresco特定节点下的空文件夹?

How to Query Empty Folders Under a Specific Path with Alfresco Lucene

Got it, let's get that query working for you! The problem with your original attempt is that Alfresco's Lucene implementation doesn't recognize the "Children is empty" syntax—we need to use the built-in metadata properties that Alfresco tracks for nodes.

Correct Lucene Query

Here's the adjusted query that will return all empty folders under your target path:

+PATH:"/app:company_home/cm:contexts/cm:ctx_exploitation/cm:runs/cm:Run_322645//." +@cm\:isFolder:true +@cm\:childCount:0

Breakdown of Each Part

  • +PATH:"/app:company_home/cm:contexts/cm:ctx_exploitation/cm:runs/cm:Run_322645//.": This part stays as you had it—it targets all nodes under the specified path (the //. ensures we include all sub-levels under Run_322645).
  • +@cm\:isFolder:true: This filters results to only include folders (excludes files we don't care about here). The \ escapes the colon since it's a special character in Lucene.
  • +@cm\:childCount:0: Alfresco automatically maintains a cm:childCount property for every node, which counts direct child nodes. Setting this to 0 ensures we only get folders with no children.

Why Your Original Query Failed

Alfresco doesn't support natural language-style checks like "Children is empty" in Lucene queries. You have to leverage pre-populated metadata properties provided by Alfresco—cm:childCount is the right tool for this job.

If you prefer an alternative way to write the empty check, you could also use:

+NOT @cm\:childCount:[1 TO *]

This does the same thing (excludes any folder with 1 or more children), but @cm\:childCount:0 is more straightforward.

内容的提问来源于stack exchange,提问作者CHHIBI AMOR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 04:04:28