Bug 15927 - Spotlight search restriction for shares incomplete and default search searches in too many attributes
Summary: Spotlight search restriction for shares incomplete and default search searche...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: DCE-RPCs and pipes (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-02 15:16 UTC by Ralph Böhme
Modified: 2025-11-21 10:24 UTC (History)
1 user (show)

See Also:


Attachments
Patch for 4.22 and 4.23 cherry-picked from master (23.68 KB, patch)
2025-10-14 09:40 UTC, Ralph Böhme
vl: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2025-10-02 15:16:33 UTC
Have patch, need bugnumber.
Comment 1 Ralph Böhme 2025-10-10 09:00:30 UTC
There are two issues in mdssvc:

1. The client Spotlight search is per share and mdssvc maps this to a specific Elasticsearch filter based on the absolute path prefix of the smb.conf share. The way this is currently implemented has two flaws: the filter is not anchored at the beginning at the string and it doesn't correctly differentiate between /foo/bar and /foo/bar2 as the filter used is /foo/bar which matches both. To get filter behaviour similar to a regex "^" anchor, we have to use a prefix filter and ensure the filter path has a trailing slash.

2. mdssvc maps the Spotlight wildcard attribute match query ("*") to also search in all attributes in ES which might run into an ES limit if more attributes are available then a configurable maximum. As a better sensible default when mapping from Spotlight "*", we now use a confiruble list of fields which defaults to ["file.filename", "content"].
Comment 2 Samba QA Contact 2025-10-10 11:44:11 UTC
This bug was referenced in samba master:

a8791c0cad4fb03606ea484c2da7ee69d9de5d48
594eb4eb0eb4a6c87c5b136106afd05357b80e91
2b5cbb955ab2cf278272aa8457a672aa27ff1020
Comment 3 Ralph Böhme 2025-10-14 09:40:34 UTC
Created attachment 18756 [details]
Patch for 4.22 and 4.23 cherry-picked from master
Comment 4 Jule Anger 2025-10-15 13:38:43 UTC
Pushed to autobuild-v4-{23,22}-test.
Comment 5 Samba QA Contact 2025-10-15 15:11:12 UTC
This bug was referenced in samba v4-23-test:

e554174d6b38b968c31569536ef4f641fbd3b855
39d2fcb240159521f8a88f2c112e752c798fa708
76257068f6e64186114703f5337d0a70c94d942c
Comment 6 Samba QA Contact 2025-10-15 16:05:11 UTC
This bug was referenced in samba v4-22-test:

e48cbfa16ed8faf67df1e8f053b8356e6d67c287
daf79bd15b3bdd2355200ad0d5b9763fcd6d14cb
6a306f8d3bffdb62e6da4a3b5bb921dccad068aa
Comment 7 Jule Anger 2025-10-15 16:34:35 UTC
Closing out bug report.

Thanks!
Comment 8 Samba QA Contact 2025-10-16 14:38:06 UTC
This bug was referenced in samba v4-22-stable (Release samba-4.22.6):

e48cbfa16ed8faf67df1e8f053b8356e6d67c287
daf79bd15b3bdd2355200ad0d5b9763fcd6d14cb
6a306f8d3bffdb62e6da4a3b5bb921dccad068aa
Comment 9 Samba QA Contact 2025-11-07 13:23:51 UTC
This bug was referenced in samba v4-23-stable (Release samba-4.23.3):

e554174d6b38b968c31569536ef4f641fbd3b855
39d2fcb240159521f8a88f2c112e752c798fa708
76257068f6e64186114703f5337d0a70c94d942c