Bug 12545 - macOS 10.12 Spotlight query can't be mapped
Summary: macOS 10.12 Spotlight query can't be mapped
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-31 15:04 UTC by Ralph Böhme
Modified: 2017-02-21 08:48 UTC (History)
2 users (show)

See Also:


Attachments
Patch for 4.4, 4.5 and 4.6 cherry-picked from master (1.14 KB, patch)
2017-02-15 17:49 UTC, Ralph Böhme
jra: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2017-01-31 15:04:08 UTC
This is the raw Spotlight query when searching for "text":

  kMDItemContentTypeTree=="public.text"&&(kMDItemContentType=="public.plain-text"||kMDItemFSName=="*txt"cdw||*=="text*"cdw||kMDItemTextContent=="text*"cdw)

Our parser chokes because it doesn't know the attribute "kMDItemContentType".

Patch to follow...
Comment 1 Ralph Böhme 2017-01-31 15:05:36 UTC
Eg

$ ./bin/spotlight2sparql 'kMDItemContentTypeTree=="public.text"&&(kMDItemContentType=="public.plain-text"||kMDItemFSName=="*txt"cdw||*=="text*"cdw||kMDItemTextContent=="text*"cdw)'

*mapping failed*
$

But this works

$ ./bin/spotlight2sparql 'kMDItemContentTypeTree=="public.plain-text"||kMDItemFSName=="*txt"cdw||*=="text*"cdw||kMDItemTextContent=="text*"cdw'

SELECT ?url WHERE { { { ?obj nie:mimeType 'text/plain' } UNION { ?obj nfo:fileName ?a FILTER(regex(?a, '^.*txt$', 'i')) } } UNION { ?obj fts:match 'text*' } . ?obj nie:url ?url . FILTER(tracker:uri-is-descendant('file:///foo/bar/', ?url)) }
$
Comment 2 Ralph Böhme 2017-02-15 17:49:08 UTC
Created attachment 12944 [details]
Patch for 4.4, 4.5 and 4.6 cherry-picked from master
Comment 3 Jeremy Allison 2017-02-15 20:13:43 UTC
Re-assigning to Karolin for inclusion in 4.6.next, 4.5.next, 4.4.next.
Comment 4 Karolin Seeger 2017-02-17 10:53:52 UTC
(In reply to Jeremy Allison from comment #3)
Pushed to autobuild-v4-{6,5,4}-test
Comment 5 Karolin Seeger 2017-02-21 08:48:01 UTC
(In reply to Karolin Seeger from comment #4)
Pushed to all branches.
Closing out bug report.

Thanks!