Why doesn't Spotlight find my Core Data external record files?

On recent OS releases (High Sierra and Mojave Beta ), I'm getting reports that users aren't seeing Spotlight results for my app.


I can reproduce the problem on some (but not all) Macs.


Here's what I've found:


The importer is present when I run

mdimport -L


The importer seems to be working property when run with

mdimport <path-to-external-record-file>


Once I add the external record file "manually" as above, it is present in the index and appears in Spotlight search results.


It seems like for whatever reason Spotlight is not finding my external record files by itself.


The records have always been stored in a subdirectory of ~/Library/CoreData as recommended in the docs. The app is NOT sandboxed. I've tried resetting my index numerous times. While I'd like to move to Core Spotlight, I don't have the resources to do that at the moment, so I need to get this working again.


Can anyone shed some light on this? Thanks