mdssvc: fix filtering by share path prefix and restrict default fields

This addresses 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"].

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

Edited by Ralph Böhme

Merge request reports

Loading