Spotlight

RSS for tag

Search for files and index your app’s content for searching using Spotlight.

Posts under Spotlight tag

28 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

NSMetaData Object IOS
I've been trying to access the NSMetaData information for mb4 objects that I legally downloaded from third party websites without DRM protection. I posted a request in the app forum before and didn't receive any responses from anyone, so it occurred to me to use the example apple code provided on NSMetaData Objects. Steps to reproduce: download the "simpleiclouddocument" example and changed the document extension to Mb4. It seems the query fails because the documents are outside the application directory, so I expanded the search scope to include "NSMetaDataQueryAccessibleExternalDocumentsScope" and the files are still not found. I have the URL of the file that I want the MetaData for. I understand that NSMetaData has an init object that works with a URL but it only works on MacOS and not iOS. I have alternatively tried using LPLinkPresentation and AVMetdataItem but these two alternatives appear to limit the metadata fields I can access and there is no additional object data on how to expand the links to access the other metadata items associated with the file, specifically the Author field as Mb4 files have authors in addition to other audio metadata settings. If there is additional information somewhere on those two classes that identifies how I can access the rest of the metadata fields that would likewise correct my problem.
3
0
142
2w
Spotlight App Extension does not persist custom Attributes
We are in the process of updating our legacy Spotlight MDImporter to the new macOS Spotlight App Extension. The transition works well for standard attributes such as title, textContent, and keywords. However, we encounter an issue when adding custom attributes to the CSSearchableItemAttributeSet. These custom attributes are not being persisted, which means they cannot be queried using a Spotlight NSMetadataQuery. Has anyone an idea on how to append custom attributes so that they are included in the indexed file status, as displayed by the shell command mdimport -t -d3 <path> A sample project illustrating the problem is available here: https://www.dropbox.com/scl/fi/t8qg51cr1rpwouxdl900b/2024-09-04-Spotlight-extAttr.zip?rlkey=lg6n9060snw7mrz6jsxfdlnfa&dl=1
1
0
114
36s
Is there a Spotlight volume size limit?
I am asking here after finding no information on this anywhere. There doesn't appear to be any documentation on this. I am having trouble with an 18TB volume over a simple SMB network. One iMac; one Mac Mini with attached storage, ethernet 10g. I have a 6TB volume that has no issues over the same network. Settings are all the same as far as I know. Both hard drives have a VolumeConfiguration.plist /Volumes/Media_1/.Spotlight-V100/VolumeConfiguration.plist /Volumes/Media_2/.Spotlight-V100/VolumeConfiguration.plist Media_1 is the 18TB HDD Media_2 is the 6TB HDD I ran diff on both volumes' VolumeConfiguration.plist and what jumped out was the different string in "PolicyProcess": diff /Users/john/Documents/media_2plist.txt /Users/john/Documents/media_1plist.txt |colordiff | $(brew --prefix git)/share/git-core/contrib/diff-highlight/diff-highlight 3c3 < 16D4F012-5E09-4D3B-ACD4-6768C0DA2048 = Dict { --- > 502C691E-AEE5-4729-B540-722F1C681B19 = Dict { 5,6c5,6 < PolicyProcess = mdutil < PolicyDate = Thu Jul 25 10:07:47 CST 2024 --- > PolicyProcess = STORE_ADD > PolicyDate = Tue Aug 27 19:30:08 CST 2024 Why is Spotlight choosing PolicyProcess = STORE_ADD for the 18TB HDD and PolicyProcess = mdutil for the 6TB HDD ? What is the difference between them and can I choose which PolicyProcess Spotlight uses? I can't find much from the network on the 18TB drive even after it has been re-indexed multiple times. Oddly it seems that while it is being indexed I get better results than once it has completed indexing. Thanks for any insights.
0
0
220
3w
Troubleshooting Spotlight Search Visibility for Keywords like "Food" and "Grocery"
I am seeking advice on improving the visibility of my iOS app, "noon Shopping, Food, Grocery," in Spotlight search results for certain keywords. Despite the app's name containing keywords such as "food" and "grocery," it does not seem to appear as prominently in Spotlight searches for these terms as other apps, like "Careem - rides, food & more" which appears readily when searching for "food."
1
0
314
Aug ’24
App document icon in spotlight on mac
Hello. I'm adding my mac app contents to spotlight index. I have created a dedicated exported document type which Finder also recognises and shows documents with my extension "artcl" with correct icon I provide with the app. But it does not happen in Spotlight - it shows my documents with default icon. I create items for Spotligh index as follows: let myType = UTType(filenameExtension: "artcl")! var searchableItems: [CSSearchableItem] = [] for itm in items.reversed() { let attributeSet = CSSearchableItemAttributeSet(contentType: myType) attributeSet.title = item.title attributeSet.contentDescription = item.desc attributeSet.displayName = item.name attributeSet.keywords = [ item.title ] attributeSet.comment = item.title + " " + item.desc attributeSet.contentType = "com.devaikin.spottest.artcl" let id = "artcl." + item.title + "." + item.name let indexItem = CSSearchableItem(uniqueIdentifier: id, domainIdentifier: "artcl", attributeSet: attributeSet) searchableItems.append(indexItem) let defaultIndex = CSSearchableIndex(name: "Spottest") defaultIndex.deleteAllSearchableItems() defaultIndex.beginBatch() defaultIndex.indexSearchableItems(searchableItems) ... Items are added to the spotlight and I can find them, but default icon is displayed while I would expect my exported type icon to be shown like Finder does it. Am I missing something in attributeSet setup?
0
0
259
Aug ’24
Limitations about Indexed Items for CoreSpotlight?
I know that I can index a maximum of 32767 CSSearchableItem in my application. Won't there be performance issues in a scenario where each application has the maximum number of indexes? How does the system deal with this situation? Also, let's say an application indexes the most used 32767 words, won't it abuse the system in this way and be at the top of the search results? What does Apple do about this? Is there documentation somewhere that specifically details this questions?
0
0
197
Jul ’24
onContinueUserActivity(CSSearchableItemActionType, perform) does not work on a SwiftUI macOS app
onContinueUserActivity(CSSearchableItemActionType, perform) works as expected on iOS when we search and select an item from Spotlight, but nothing happens when we do the same on a SwiftUI macOS app. var body: some Scene { WindowGroup { MyView() .onContinueUserActivity(CSSearchableItemActionType, perform: handleSpotlight) } } func handleSpotlight(_ userActivity: NSUserActivity) { // Is not called... } How can we respond to a user clicking a Spotlight result from our apps on macOS?
1
1
283
Jul ’24
Ios18 bug on “Help apple improve search”
hey guyss…. Im currently using ios18 developer beta 2 on my iphoen 12…Idk if u guys noticed it or not.. but when i turn off the toggle for “Help improve apple search” (settings->search->help improve apple search) it again turns on without my knowledge seconds aftr i close the page. Ive tried restarting my iphone & many more.. nothing seems to work.. im kindoff a more private guy i usually turn off apple analytics.. usage diagnostics and i always make sure data is stored only on my local storage.. and this bug kinda piss me off 😕. i’ve given u the link below to check it out. Peace. https://youtube.com/shorts/YfVDCA-Dfrs?si=qLcl0mWL-Jm9iJFz
1
1
472
Jul ’24
CSUserQuery Generating Model Load Failure - No Results
I'm trying CoreSpotlight on the 18b1 seed on iOS and after submitting my query, I'm getting multiple errors about what looks like missing models: [Model loading] model loading failed with err -1000 for model path /Users/hunter/Library/Developer/CoreSimulator/Devices/0AF4F46E-5510-4458-B61C-F8A153155809/data/Containers/Data/Application/1D8580C0-AC80-4949-9FDA-31DB463BDA5C/Library/Spotlight/Resources_V3/Default/models/spotlight_l2.mlmodelc and directives path /Users/hunter/Library/Developer/CoreSimulator/Devices/0AF4F46E-5510-4458-B61C-F8A153155809/data/Containers/Data/Application/1D8580C0-AC80-4949-9FDA-31DB463BDA5C/Library/Spotlight/Resources_V3/Default/directives/directives_l2.mdplist I am calling CSUserQuery.prepare() but that doesn't seem to make a difference. Is there more to this than what is on this page? https://developer.apple.com/documentation/corespotlight/building-a-search-interface-for-your-app?changes=latest_minor
3
1
419
Jul ’24
Spotlight / Finder Search / Finder Tags not working on virtual file system Monterey/Ventura
I'm writing a virtual file system as my educational project (generic kernel extension). Currently, mostly everything is implemented, however, I'm having trouble using Finder search and tags. The results simply don't show up - despite I am having vnop_... calls to those files. The extended attributes are supported. Inodes are stable. Mmap is implemented. Vnop_ioctl returns KERN_SUCCESS (but no implementation). An important moment: Previously, the search didn't work at all. Researching the web has shown me, that Spotlight indexation and Finder search are tightly glued. So basically I was trying to enable support for spotlight, thinking that would be the source of the problem. I was receiving "Unknown indexing state". All those tricks with mdutil, launchd, manual and reindexation either were doing nothing or returning error. The problem was resolved FOR SONOMA by making by VFS appear as local one (adding flags for MNT_LOLCAL and MNT_DOVOLFS). This has changed the state from Unknown indexing state for spotlight to Indexing is disabled. No need to turn it on for me - I am interested only in search and tags, not the spotlight itself. Basically, whether spotlight recognises my driver as no-error, the Finder works correctly, even with indexation disabled. Whether on Monterey*, or Ventura, I get the same problem. However, neither system logs nor my driver show any kinds of errors. The spotlight simply returns error. Reindexation attempt via Security&Privacy returns "Unknown error occured". The metadata for Ventura and Monterey read attempt (mdls) returns "Unable to locate file", however returns a huge list for Sonoma. *Monterey and Ventura never have .Spotlight-V100 folder. No disable indexing files or other spotlight restrictions are present. No user space solutions seem to help. The kext is unsigned and running in an environment with SIP disabled and Security Mode reduced to Permissive. Maybe there some abstract rules for what is required on VFS side to be recognised okay'ish by Spotlight ? Or maybe something specific right for my case ? Any pointers and/or assistance would be greatly appreciated.
9
0
581
Jun ’24
Are the new Semantic Embeddings in CoreSpotlight multi-lingual?
After watching https://developer.apple.com/wwdc24/10131, I'm curious if the semantic embeddings used to provide the "search of meaning" with this new capability are encoded with multi-lingual embeddings? In particular, if I have content that is mixed in Korean and English, can those be seamlessly indexed together and queries in one language (english) find relevant content that was offered to be indexed as Korean?
0
1
345
Jun ’24
How to create AppEntity shortcut to be shown in Spotlight
I am exploring Appi-Intent and Appshortcut. We can create an action shortcut by using the following code. struct WatchListShortcut: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: WatchListAppIntent(), phrases: [ "Tell \(.applicationName) to open first item in watch list", ], shortTitle: "WatchList item", systemImageName: "systemimage" ) } } What I want to show an entity shortcut like shown in the below screenshot. linkText I am not sure how to create the shortcut like Assigned one in the above screen.
0
0
536
Apr ’24
SecCodeCopyPath and /System/Volumes/Preboot/Cryptexes/App/System
Looking at the path name for reasons, and ran into a thing: one of my coworkers was not getting /Applications/Safari.app as expected, but instead got /System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app. Which is annoying because I'm actually using spotlight to find the paths for applications, and that one doesn't show up. Has anyone run into this? And know why? (I figure I'll simply remove the prefix if it's there, and that should be fine, but I'm curious why it only seems to happen sometimes.)
4
0
1.6k
Feb ’24