macOS: use native Spotlight
Since 10.4, macOS has had a powerful search engine called Spotlight. It should be possible for Netatalk, if ran on a macOS computer, to hook into the built-in search service. This would remove the need to set-up a separate search tracker on Macs to get search working.
I assume you mean the Core Spotlight API[1] ? Glancing through the documentation, the API allows for indexing files so it should be feasible, at a high level.
There are a few fundamental technical challenges to solve off the bat:
- Netatalk is pure C, while the Core Spotlight API is Objective-C. Shall the Spotlight implementation be mixed C and ObjC, or a separate Obj-C library that afpd is linked with?
- Can Meson build mixed C and ObjC projects? Can the Ninja build backend build mixed C and ObjC code, or do we have to add Xcode build backend support to the build system?
- Is the Core Spotlight API fork safe? The netatalk daemons use forking liberally, which Apple officially do not allow in Objective-C code, but works under some circumstances. [2] (We recently stopped linking with Apple's LDAP framework to get away from this problem.)
[1] https://developer.apple.com/documentation/corespotlight?language=objc [2] https://developer.apple.com/forums/thread/737464?answerId=764686022#764686022
Objective-C is an extension to C. The two can be mixed without too much issue (C++ on the other hand....). Forking shouldn't be an issue if you isolate the interface to a separate process (this can keep the Netatalk side as C as well, just wrap the Obj-C calls in that separate helper process).
Meson shouldn't have a problem with Objective-C. All the major compiler suites support it as well.
There's a C-based API in CoreServices called SearchKit.
Search Kit seems like the more appropriate API to use for this purpose.
The Search Kit API is appropriate when you want your application to have full control over indexing and searching, and when your focus is file content. Search Kit is thread-safe and works with Cocoa, Carbon, and command-line tools.
https://developer.apple.com/documentation/coreservices/search_kit?language=objc