mdssvc: better support for search with mdfind from Macs
commiteadd7e5f9bbe6b52e1690a37e0f1c98954e14643
authorRalph Boehme <slow@samba.org>
Tue, 29 Aug 2023 14:14:38 +0000 (29 16:14 +0200)
committerJule Anger <janger@samba.org>
Tue, 5 Sep 2023 09:33:16 +0000 (5 09:33 +0000)
treed5b136c93dc44cca9b4d3ed9e1b3892289621eba
parenta8c5fe34b639f72c045bc0500d0c053842327556
mdssvc: better support for search with mdfind from Macs

When searching Samba via Spotlight from a Mac with mdfind, only 50 results are
returned.

It seems the changes for bug #15342 where one step in the right
direction. There, a status indicator meaning "search is still being processed"
was implemented, returning a special status indicator (0x23) in a response, when
the query was still running in the backend, eg Elasticsearch, and we haven't got
any result when when the Mac already comes along asking for results of a query.

Turns out, we should also return 0x23, ie "search is still being processed" when
we have some initial search results from the backend. Otherwise mdfind will stop
querying for more results. It works in Finder, as the Finder by default employs
a "live" search where it just keeps polling for more results even after the
server returned an empty result set. The Finder just keeps on querying in some
interval, typically 4 seconds, and a Mac server Spotlight server might return
new results if new files where created that match the query, hence "live"
search.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15463

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Aug 30 10:51:40 UTC 2023 on atb-devel-224

(cherry picked from commit 3afa27a01ca0b81b0044d5d543a999936582e67a)

Autobuild-User(v4-19-test): Jule Anger <janger@samba.org>
Autobuild-Date(v4-19-test): Tue Sep  5 09:33:17 UTC 2023 on atb-devel-224
source3/rpc_server/mdssvc/mdssvc.c