From 04b08b06a5f3be9802f403d532894cfe6d743e41 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 15 Oct 2025 14:56:51 +0200 Subject: [PATCH 1/3] mdssvc: reduce a log level to DEBUG The expression InRange(*,$time.iso(2024-12-31T23:00:00Z),$time.iso(2025-12-31T23:00:00Z)) in a Spotlight query produces the following log message: map_fts: Mapping fts [757378800] unexpected op [~] However, when elasticsearch:ignore unknown attribute = yes is set, the parser will ignore the failed expression and continue parsing given the expression is part of a larger expression like "subexpression1 OR subexpression2". Avoid spamming the log and reduce the loglevel when we hit this case. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15930 Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke (cherry picked from commit 3b2b50983901ad5039124b82f149b30675c80a9a) --- source3/rpc_server/mdssvc/es_parser.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/rpc_server/mdssvc/es_parser.y b/source3/rpc_server/mdssvc/es_parser.y index 62ca63d90f20..cea2ce8eb0c6 100644 --- a/source3/rpc_server/mdssvc/es_parser.y +++ b/source3/rpc_server/mdssvc/es_parser.y @@ -412,7 +412,7 @@ static char *map_fts(const struct es_attr_map *attr, end = ")"; break; default: - DBG_ERR("Mapping fts [%s] unexpected op [%c]\n", val, op); + DBG_DEBUG("Mapping fts [%s] unexpected op [%c]\n", val, op); return NULL; } -- 2.50.0 From c8c0d7db5291e5c2dc3eca0f6a505727cab0f465 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Fri, 17 Oct 2025 12:38:53 +0200 Subject: [PATCH 2/3] mdssvc: add a test for parsing Spotlight date ranges BUG: https://bugzilla.samba.org/show_bug.cgi?id=15930 Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke (cherry picked from commit 1239e5a4c7f5930a4a1b3a6a7a005f4d543a5ea5) --- selftest/knownfail.d/samba.unittests.mdsparser_es | 1 + source3/rpc_server/mdssvc/test_mdsparser_es.c | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 selftest/knownfail.d/samba.unittests.mdsparser_es diff --git a/selftest/knownfail.d/samba.unittests.mdsparser_es b/selftest/knownfail.d/samba.unittests.mdsparser_es new file mode 100644 index 000000000000..b5d7bc84c1e1 --- /dev/null +++ b/selftest/knownfail.d/samba.unittests.mdsparser_es @@ -0,0 +1 @@ +^samba.unittests.mdsparser_es.*test_mdsparser_es\(none\) diff --git a/source3/rpc_server/mdssvc/test_mdsparser_es.c b/source3/rpc_server/mdssvc/test_mdsparser_es.c index a61f84ceaff9..5015de821278 100644 --- a/source3/rpc_server/mdssvc/test_mdsparser_es.c +++ b/source3/rpc_server/mdssvc/test_mdsparser_es.c @@ -155,6 +155,9 @@ static struct { }, { "InRange(kMDItemFSSize,1,2)", "file.filesize:[1 TO 2]" + }, { + "InRange(kMDItemContentCreationDate,$time.iso(2024-12-31T23:00:00Z),$time.iso(2025-12-31T23:00:00Z))", + "file.created:[2024\\\\-12\\\\-31T23\\\\:00\\\\:00Z TO 2025\\\\-12\\\\-31T23\\\\:00\\\\:00Z]" } }; -- 2.50.0 From 69f9a1107e515632aef63f0cce49025196eb4cb1 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 15 Oct 2025 15:01:16 +0200 Subject: [PATCH 3/3] mdssvc: add support for parsing date ranges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Example: InRange(kMDItemContentCreationDate,$time.iso(2024-12-31T23:00:00Z),$time.iso(2025-12-31T23:00:00Z)) BUG: https://bugzilla.samba.org/show_bug.cgi?id=15930 Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Mon Oct 20 10:59:03 UTC 2025 on atb-devel-224 (cherry picked from commit c00de32585bf47ec4753f966fe9ac4dd2fb8f4e7) --- selftest/knownfail.d/samba.unittests.mdsparser_es | 1 - source3/rpc_server/mdssvc/es_parser.y | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) delete mode 100644 selftest/knownfail.d/samba.unittests.mdsparser_es diff --git a/selftest/knownfail.d/samba.unittests.mdsparser_es b/selftest/knownfail.d/samba.unittests.mdsparser_es deleted file mode 100644 index b5d7bc84c1e1..000000000000 --- a/selftest/knownfail.d/samba.unittests.mdsparser_es +++ /dev/null @@ -1 +0,0 @@ -^samba.unittests.mdsparser_es.*test_mdsparser_es\(none\) diff --git a/source3/rpc_server/mdssvc/es_parser.y b/source3/rpc_server/mdssvc/es_parser.y index cea2ce8eb0c6..1f1c02ba1a5b 100644 --- a/source3/rpc_server/mdssvc/es_parser.y +++ b/source3/rpc_server/mdssvc/es_parser.y @@ -219,6 +219,13 @@ FUNC_INRANGE OBRACE attribute COMMA WORD COMMA WORD CBRACE { } else { $$ = map_expr($3, '~', $5, $7); } +} +| FUNC_INRANGE OBRACE attribute COMMA isodate COMMA isodate CBRACE { + if ($3 == NULL) { + $$ = NULL; + } else { + $$ = map_expr($3, '~', $5, $7); + } }; attribute: -- 2.50.0