问题标签 [spotlight]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
830 浏览

python - How can I write a python script equivalent of mdfind using PyObjC bindings and NSMetadataQuery?

I want to write the python equivalent of mdfind. I want to use the .Spotlight-V100 metadata and I cannot find a description for the metadata db format used, but NSMetadataQuery seems to be what I need. I'd like to do this in python using the built in Obj-C bindings, but have not been able to figure out the correct incantation to get it to work. Not sure if the problem is the asynchronous nature of the call or I'm just wiring things together incorrectly.

A simple example giving the equivalent of of "mdfind " would be fine for a start.

0 投票
1 回答
342 浏览

objective-c - 使用 Spotlight 搜索结果以特定状态打开应用程序

我有一个应用程序,可以通过从下拉菜单中选择来播放一系列广播电台。理想情况下,我想添加一些代码,以便聚焦搜索将返回下拉列表中的任何项目并打开应用程序,就像您在应用程序本身中执行此操作一样。

除了我发现一些关于创建要索引的隐藏文件的旧帖子之外,聚光灯文档没有提供任何线索来说明这是否可能。

有什么线索吗?

0 投票
1 回答
460 浏览

macos - 如何停止显示外部记录文件路径的 OS X Core Data Spotlight 帮助标签?

我正在为 OS X 10.6 开发一个非基于文档的核心数据应用程序。它基于 XCode 3.2.4 生成的模板,当“创建基于文档的应用程序”没有被选中并且“使用 Core Data for Storage”和“包含 Spotlight Importer”选中时。

我的 Spotlight 导入器将 kMDItemDisplayName 设置为主数据库表行的摘要。没有设置其他 kMDItem 属性。不会从持久存储中导入元数据,仅从外部记录文件中导入。

一切正常,但有一个例外:

当我将鼠标悬停在 Spotlight 结果上时,黄色帮助标签会显示相应数据库记录的外部记录文件的路径。对于普通用户来说,这看起来像是胡言乱语,即
/Users/username/Library/Caches/Metadata/CoreData/appname/uuid/entity/x/y。

有没有办法阻止这种情况发生?理想情况下,我希望帮助标签引用我的应用程序的名称。

我尝试设置其他几个 kMDItem 属性,但它们似乎不会更改显示的帮助标签。

0 投票
2 回答
1140 浏览

objective-c - NSMetaDataQuery,将 setSearchScope 路径设置为递归?

在 Objective-C 中,我设置NSMetaDataQuery并设置setSearchScope:查询以搜索特定用户的 Documents 文件夹。搜索有效,但不会沿目录树递归,仅在 Documents 文件夹中搜索。
我试过通配符,但没有乐趣。

这基本上是我尝试过的,除了不在 Documents 目录下搜索之外,它可以工作:

0 投票
4 回答
3672 浏览

iphone - iOS 中的核心数据聚焦集成

我正在开发一个 ios (3.1.3) 应用程序来管理联系人、任务、活动等。这些模型由核心数据管理,并且运行良好。现在我想让所有这些项目都可以在 iOS 的聚光灯搜索栏中进行搜索。

那可能吗?

如果是这样,如何编码?我找到了“Core Data Spotlight 集成编程指南”,但它不适合 iOS,而且我没有找到任何与我想要的相关的文档或教程。

有什么想法、建议吗?或完整的解决方案!:D

提前致谢!

0 投票
1 回答
295 浏览

macos - OS X Spotlight 从用户定义的数据库中搜索?

自 10.5 以来,Mac OS X 上的 Spotlight 具有您可能已经看到的这种不错的字典集成:

Spotlight 中的字典集成

任何想法如何实现这样的事情?

当前的 Dictionary+Spotlight 友谊似乎在某种程度上被硬编码到 Spotlight 的代码中(例如,有一个特定的用户默认键com.apple.spotlight.DictionaryLookupEnabled仅用于切换字典搜索)。

我在Spotlight Importer Programming Guide中读到,只能在每个文档的基础上创建 Spotlight 导入器,也就是说,如果您的应用程序Foobar打开/创建带有扩展名的文件.foo,那么您可以编写一个 Spotlight 导入器来索引这些属性文件。

然而,我需要的是让 Spotlight 以某种方式使用自己的查询来查询某种数据库(正是它现在对 Dictionary 所做的)。

0 投票
1 回答
342 浏览

cocoa - 为 Spotlight 元数据查询配置 NSPredicateEditor(RowTemplate)I'

我正在尝试配置一个NSPredicateEditor(在 Interface Builder 中)来编辑一个NSMetadataQuery.

作为第一步,我尝试配置一个NSPredicateEditorRowTemplate接受左侧表达式的键路径,尝试使用单个 keyPath ( kMDItemTextContent) 开始。

我不知道如何将所有部分都放入 IB。我选择了行模板,并在 IB Attributes Inspector 中将“Left Exprs”设置为“Key Paths”。但是,使用 Apple 的 PhotoSearch 示例作为模型,我似乎应该在此处输入用户可读的属性名称(例如“内容”);我不知道如何将它绑定到“ kMDItemTextContent”。

我在 PhotoSearch(*) 中剖析了(正确配置的)NIB,其中有一个NSKeyPathExpression指定附加到NSPopUpButton/的元数据属性NSPopUpButtonCell

NSPopUpButton我不知道在 IB 中导航到哪里可以找到NSExpression.

任何帮助表示赞赏。

(*) 如果您想知道,我通过将其转换为 XIB 进入了 NIB,确认它仍然正确构建,然后使用 BBEdit 检查它。

0 投票
1 回答
496 浏览

cocoa - 现成的 Cocoa Spotlight UI 组件

我是在 Mac 上开发的新手,我希望实现一个类似于 Spotlight 的界面——主要部分似乎是一个扩展的表格/网格视图。

替代文字

我想知道 Apple 是否提供了一个组件来创建类似的东西,或者在其他地方可以使用开源。

当然,如果不是,我会尝试自己解决一些问题,但它总是值得检查!

提前感谢您的帮助。

0 投票
1 回答
1086 浏览

cocoa - How can I force Spotlight to index my application's plain text files in the user's ~/Library/Application Support directory?

I have a directory of plain text files in ~/Library/Application Support/MyApp/Spotlight/. I understand that Spotlight stopped indexing the Library in 10.5, but is there a way to force Spotlight to include a single sub-directory in its index?

I've tried wrapping mdimport in an NSTask, and the debug output says that the file has been imported, but it does not show up in Spotlight results.

@bbum's answer here leads me to believe this should be trivial, but I'm at a loss.

Any help or pointers are greatly appreciated.

Thanks.

0 投票
3 回答
301 浏览

objective-c - 如何在 Objective-C 中搜索目录并在表中显示搜索结果

我想创建一个 iTunes 风格的搜索功能,其中搜索字段将查看目录的内容并将结果显示在NSTableView.
这将专门用于音乐,因此搜索字段应匹配歌曲名称、艺术家姓名或歌曲名称。

有没有办法在 Objective-C 中做到这一点,而无需将目录的内容添加到第一个目录中NSTableView