首页 > 解决方案 > Spotlight (mdfind) 元数据在 macOS BigSur 11.3 更新后更改

问题描述

我将笔记保存在 Emacs org-mode 中,文件以 .org 结尾。我使用 mdfind 对这些文件进行全文搜索,命令如下:

mdfind -only <dir> kind:org <search terms>

我昨天更新了 Big Sur 11.3。在没有得到预期的搜索结果后,我注意到 org 文件的元数据现在将它们标记为“文档”文件。所以我可以使用 kind:doc 进行搜索,但它也可以捕获所有类型的文本文件,以及 html、pdf 等。

新旧文件的元数据示例:

    ==> mdls 2020-06-27--14-43-20Z--converting_docs_in_epub_format.org | grep -E 'kMDItemKind|kMDItemContentType'
kMDItemContentType                     = "dyn.ah62d4rv4ge8086xh"
kMDItemContentTypeTree                 = (
kMDItemKind                            = "Document"


==> mdls 2020-12-07--17-14-42Z--technology_linuxdesktop.org | grep -E 'kMDItemKind|kMDItemContentType'
kMDItemContentType                     = "org.orgmode.org"
kMDItemContentTypeTree                 = (
kMDItemKind                            = "Org document"

有没有人有任何技巧让 mdfind 开始正确标记这些文件,所以我可以再次使用 kind:org 进行搜索?

标签: macossearchspotlightmdfind

解决方案


推荐阅读