From d1c0246e96248e30f9330a112bb03553322b2695 Mon Sep 17 00:00:00 2001 From: hyunah-jang_kyndryl Date: Wed, 27 Aug 2025 09:18:54 +0900 Subject: [PATCH 01/11] Fix: SQLProvider and SearchOption logic update --- src/Glpi/Search/Provider/SQLProvider.php | 5 +++++ src/Glpi/Search/SearchOption.php | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/Glpi/Search/Provider/SQLProvider.php b/src/Glpi/Search/Provider/SQLProvider.php index 2fc62747c9c..8094efd19c8 100644 --- a/src/Glpi/Search/Provider/SQLProvider.php +++ b/src/Glpi/Search/Provider/SQLProvider.php @@ -9,6 +9,7 @@ * * @copyright 2015-2025 Teclib' and contributors. * @copyright 2003-2014 by the INDEPNET Development Team. + * @copyright 2025 Kyndryl Inc. * @licence https://www.gnu.org/licenses/gpl-3.0.html * * --------------------------------------------------------------------- @@ -1336,6 +1337,10 @@ public static function getWhereCriteria($nott, $itemtype, $ID, $searchtype, $val $SEARCH = null; } break; + + case "matches": + $SEARCH = [$nott ? "<>" : "=", $val]; + break; } //Check in current item if a specific where is defined diff --git a/src/Glpi/Search/SearchOption.php b/src/Glpi/Search/SearchOption.php index a73097817bb..bac2f1dfbfb 100644 --- a/src/Glpi/Search/SearchOption.php +++ b/src/Glpi/Search/SearchOption.php @@ -9,6 +9,7 @@ * * @copyright 2015-2025 Teclib' and contributors. * @copyright 2003-2014 by the INDEPNET Development Team. + * @copyright 2025 Kyndryl Inc. * @licence https://www.gnu.org/licenses/gpl-3.0.html * * --------------------------------------------------------------------- @@ -452,6 +453,10 @@ public static function getActionsFor($itemtype, $field_num) } foreach ($actions['searchopt']['searchtype'] as $searchtype) { switch ($searchtype) { + case "matches": + $actions['matches'] = __('matches'); + break; + case "equals": $actions['equals'] = __('is'); break; @@ -580,6 +585,7 @@ public static function getActionsFor($itemtype, $field_num) case 'name': case 'completename': $actions = [ + 'matches' => __('matches'), 'contains' => __('contains'), 'notcontains' => __('not contains'), 'equals' => __('is'), From 4b9bf94719547e4266b1601fcce40622121d3518 Mon Sep 17 00:00:00 2001 From: hyunah-jang_kyndryl Date: Fri, 29 Aug 2025 14:51:12 +0900 Subject: [PATCH 02/11] Modifying the location of matches options --- src/Glpi/Search/SearchOption.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Glpi/Search/SearchOption.php b/src/Glpi/Search/SearchOption.php index bac2f1dfbfb..154b950c70b 100644 --- a/src/Glpi/Search/SearchOption.php +++ b/src/Glpi/Search/SearchOption.php @@ -585,9 +585,9 @@ public static function getActionsFor($itemtype, $field_num) case 'name': case 'completename': $actions = [ - 'matches' => __('matches'), 'contains' => __('contains'), 'notcontains' => __('not contains'), + 'matches' => __('matches'), 'equals' => __('is'), 'notequals' => __('is not'), 'empty' => __('is empty'), From ff362b27491a5763959295bafb386deb447dd3f0 Mon Sep 17 00:00:00 2001 From: hyunah-jang_kyndryl Date: Tue, 2 Sep 2025 17:19:36 +0900 Subject: [PATCH 03/11] Fix code style: remove unnecessary whitespace and blank lines --- src/Glpi/Search/Provider/SQLProvider.php | 2 +- src/Glpi/Search/SearchOption.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Glpi/Search/Provider/SQLProvider.php b/src/Glpi/Search/Provider/SQLProvider.php index 8094efd19c8..528c7aa05da 100644 --- a/src/Glpi/Search/Provider/SQLProvider.php +++ b/src/Glpi/Search/Provider/SQLProvider.php @@ -1337,7 +1337,7 @@ public static function getWhereCriteria($nott, $itemtype, $ID, $searchtype, $val $SEARCH = null; } break; - + case "matches": $SEARCH = [$nott ? "<>" : "=", $val]; break; diff --git a/src/Glpi/Search/SearchOption.php b/src/Glpi/Search/SearchOption.php index 154b950c70b..bd6c2e698b4 100644 --- a/src/Glpi/Search/SearchOption.php +++ b/src/Glpi/Search/SearchOption.php @@ -456,7 +456,7 @@ public static function getActionsFor($itemtype, $field_num) case "matches": $actions['matches'] = __('matches'); break; - + case "equals": $actions['equals'] = __('is'); break; From 3ab9e62adc6372dde5d1e3b5015a1acca4533df0 Mon Sep 17 00:00:00 2001 From: hyunah-jang_kyndryl Date: Wed, 3 Sep 2025 08:58:41 +0900 Subject: [PATCH 04/11] Add 'matches' search type and update order in available_searchtypes --- phpunit/web/APIRestTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit/web/APIRestTest.php b/phpunit/web/APIRestTest.php index 5479c4f9d96..b2a12a2336a 100644 --- a/phpunit/web/APIRestTest.php +++ b/phpunit/web/APIRestTest.php @@ -360,7 +360,7 @@ public function testListSearchOptions() $this->assertIsArray($data[1]['available_searchtypes']); $this->assertSame( - ['contains', 'notcontains', 'equals', 'notequals', 'empty'], + ['contains', 'notcontains', 'matches', 'equals', 'notequals', 'empty'], $data[1]['available_searchtypes'] ); } From d62b9ed1fc99698598c5dd7173e19d8a1fe4c5e8 Mon Sep 17 00:00:00 2001 From: hyunah-jang_kyndryl Date: Fri, 5 Sep 2025 13:44:19 +0900 Subject: [PATCH 05/11] Add test for 'matches' search option in SearchTest --- phpunit/functional/SearchTest.php | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/phpunit/functional/SearchTest.php b/phpunit/functional/SearchTest.php index 29894c687a5..87c19a6a901 100644 --- a/phpunit/functional/SearchTest.php +++ b/phpunit/functional/SearchTest.php @@ -1043,6 +1043,43 @@ public function testSearchAllMeta() } } + public function testMatchesSearchOption() + { + $classes = $this->getSearchableClasses(); + foreach ($classes as $class) { + $item = new $class(); + $name = '_test_matches_' . uniqid(); + // Test only if the name field exists + if ($item->fields && array_key_exists('name', $item->fields)) { + $id = $item->add([ + 'name' => $name, + 'entities_id' => 0, + 'is_recursive' => 1, + ]); + $this->assertGreaterThan(0, $id); + + $search_params = [ + 'is_deleted' => 0, + 'start' => 0, + 'matches' => $name, + 'criteria' => [], + ]; + $data = $this->doSearch($class, $search_params); + + $found = false; + if (isset($data['data']['rows'])) { + foreach ($data['data']['rows'] as $row) { + if (isset($row['name']) && $row['name'] === $name) { + $found = true; + break; + } + } + } + $this->assertTrue($found, $class); + } + } + } + /** * Get criterion params for corresponding SO. * From 310e0b95b94a089942e6cbdfc93f0b851ee661d1 Mon Sep 17 00:00:00 2001 From: hyunah-jang_kyndryl Date: Fri, 5 Sep 2025 16:35:21 +0900 Subject: [PATCH 06/11] Add 'matches' search option to deprecated-searchoptions JSON files --- phpunit/deprecated-searchoptions/ComputerAntivirus.json | 1 + phpunit/deprecated-searchoptions/ComputerVirtualMachine.json | 1 + .../deprecated-searchoptions/Computer_SoftwareLicense.json | 2 ++ .../deprecated-searchoptions/Computer_SoftwareVersion.json | 4 +++- phpunit/deprecated-searchoptions/TicketFollowup.json | 4 +++- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/phpunit/deprecated-searchoptions/ComputerAntivirus.json b/phpunit/deprecated-searchoptions/ComputerAntivirus.json index 747ca1106de..6218097ce6e 100644 --- a/phpunit/deprecated-searchoptions/ComputerAntivirus.json +++ b/phpunit/deprecated-searchoptions/ComputerAntivirus.json @@ -12,6 +12,7 @@ "available_searchtypes": [ "contains", "notcontains", + "matches", "equals", "notequals", "empty" diff --git a/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json b/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json index a1935591088..13d5d67df04 100644 --- a/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json +++ b/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json @@ -12,6 +12,7 @@ "available_searchtypes": [ "contains", "notcontains", + "matches", "equals", "notequals", "empty" diff --git a/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json b/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json index 33c4f14a5be..c99b17da051 100644 --- a/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json +++ b/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json @@ -26,6 +26,7 @@ "available_searchtypes": [ "contains", "notcontains", + "matches", "equals", "notequals", "empty", @@ -44,6 +45,7 @@ "available_searchtypes": [ "contains", "notcontains", + "matches", "equals", "notequals" ], diff --git a/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json b/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json index 7ec1fd9c006..506addca380 100644 --- a/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json +++ b/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json @@ -26,6 +26,7 @@ "available_searchtypes": [ "contains", "notcontains", + "matches", "equals", "notequals" ], @@ -40,7 +41,8 @@ "nodisplay": false, "available_searchtypes": [ "contains", - "notcontains", + "notcontains", + "matches", "equals", "notequals", "empty" diff --git a/phpunit/deprecated-searchoptions/TicketFollowup.json b/phpunit/deprecated-searchoptions/TicketFollowup.json index 2569f703b09..28ca45f3d6d 100644 --- a/phpunit/deprecated-searchoptions/TicketFollowup.json +++ b/phpunit/deprecated-searchoptions/TicketFollowup.json @@ -24,6 +24,7 @@ "available_searchtypes": [ "contains", "equals", + "matches", "notequals" ], "uid": "TicketFollowup.RequestType.name" @@ -68,7 +69,8 @@ "available_searchtypes": [ "contains", "equals", - "notequals" + "notequals", + "matches" ], "uid": "TicketFollowup.User.name" }, From 663f41b06a54d8a575118bf60e78fa8ecd421d28 Mon Sep 17 00:00:00 2001 From: hyunah-jang_kyndryl Date: Fri, 5 Sep 2025 22:56:20 +0900 Subject: [PATCH 07/11] test(deprecated-searchoptions): ensure 'matches' is present and ordered correctly for name fields --- phpunit/deprecated-searchoptions/ComputerAntivirus.json | 2 +- .../deprecated-searchoptions/ComputerVirtualMachine.json | 2 +- .../Computer_SoftwareLicense.json | 6 +++--- .../Computer_SoftwareVersion.json | 8 ++++---- phpunit/deprecated-searchoptions/TicketFollowup.json | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/phpunit/deprecated-searchoptions/ComputerAntivirus.json b/phpunit/deprecated-searchoptions/ComputerAntivirus.json index 6218097ce6e..cec8af4ecf3 100644 --- a/phpunit/deprecated-searchoptions/ComputerAntivirus.json +++ b/phpunit/deprecated-searchoptions/ComputerAntivirus.json @@ -12,9 +12,9 @@ "available_searchtypes": [ "contains", "notcontains", - "matches", "equals", "notequals", + "matches", "empty" ], "uid": "ComputerAntivirus.name" diff --git a/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json b/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json index 13d5d67df04..93b25529354 100644 --- a/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json +++ b/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json @@ -12,9 +12,9 @@ "available_searchtypes": [ "contains", "notcontains", - "matches", "equals", "notequals", + "matches", "empty" ], "uid": "ComputerVirtualMachine.name" diff --git a/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json b/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json index c99b17da051..5050ac66c81 100644 --- a/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json +++ b/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json @@ -26,9 +26,9 @@ "available_searchtypes": [ "contains", "notcontains", - "matches", "equals", "notequals", + "matches", "empty", "under", "notunder" @@ -45,9 +45,9 @@ "available_searchtypes": [ "contains", "notcontains", - "matches", "equals", - "notequals" + "notequals", + "matches" ], "uid": "Computer_SoftwareLicense.Computer.name" } diff --git a/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json b/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json index 506addca380..90e9822da6e 100644 --- a/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json +++ b/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json @@ -26,9 +26,9 @@ "available_searchtypes": [ "contains", "notcontains", - "matches", "equals", - "notequals" + "notequals", + "matches" ], "uid": "Computer_SoftwareVersion.Computer.name" }, @@ -41,10 +41,10 @@ "nodisplay": false, "available_searchtypes": [ "contains", - "notcontains", - "matches", + "notcontains", "equals", "notequals", + "matches", "empty" ], "uid": "Computer_SoftwareVersion.SoftwareVersion.name" diff --git a/phpunit/deprecated-searchoptions/TicketFollowup.json b/phpunit/deprecated-searchoptions/TicketFollowup.json index 28ca45f3d6d..2f5d15c3987 100644 --- a/phpunit/deprecated-searchoptions/TicketFollowup.json +++ b/phpunit/deprecated-searchoptions/TicketFollowup.json @@ -24,8 +24,8 @@ "available_searchtypes": [ "contains", "equals", - "matches", - "notequals" + "notequals", + "matches" ], "uid": "TicketFollowup.RequestType.name" }, From 8b75bb915c0d80bea6f09d192f73936face06637 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Mon, 8 Sep 2025 14:49:34 +0200 Subject: [PATCH 08/11] Remaining test fix --- phpunit/deprecated-searchoptions/ComputerAntivirus.json | 4 ++-- .../deprecated-searchoptions/ComputerVirtualMachine.json | 2 +- .../deprecated-searchoptions/Computer_SoftwareLicense.json | 7 +++---- .../deprecated-searchoptions/Computer_SoftwareVersion.json | 7 +++---- phpunit/deprecated-searchoptions/TicketFollowup.json | 6 ++---- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/phpunit/deprecated-searchoptions/ComputerAntivirus.json b/phpunit/deprecated-searchoptions/ComputerAntivirus.json index cec8af4ecf3..0e9c4090909 100644 --- a/phpunit/deprecated-searchoptions/ComputerAntivirus.json +++ b/phpunit/deprecated-searchoptions/ComputerAntivirus.json @@ -12,9 +12,9 @@ "available_searchtypes": [ "contains", "notcontains", + "matches", "equals", "notequals", - "matches", "empty" ], "uid": "ComputerAntivirus.name" @@ -47,4 +47,4 @@ ], "uid": "ComputerAntivirus.signature_version" } -} \ No newline at end of file +} diff --git a/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json b/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json index 93b25529354..13d5d67df04 100644 --- a/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json +++ b/phpunit/deprecated-searchoptions/ComputerVirtualMachine.json @@ -12,9 +12,9 @@ "available_searchtypes": [ "contains", "notcontains", + "matches", "equals", "notequals", - "matches", "empty" ], "uid": "ComputerVirtualMachine.name" diff --git a/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json b/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json index 5050ac66c81..003bf10f000 100644 --- a/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json +++ b/phpunit/deprecated-searchoptions/Computer_SoftwareLicense.json @@ -26,9 +26,9 @@ "available_searchtypes": [ "contains", "notcontains", + "matches", "equals", "notequals", - "matches", "empty", "under", "notunder" @@ -46,9 +46,8 @@ "contains", "notcontains", "equals", - "notequals", - "matches" + "notequals" ], "uid": "Computer_SoftwareLicense.Computer.name" } -} \ No newline at end of file +} diff --git a/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json b/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json index 90e9822da6e..cbc14b37e96 100644 --- a/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json +++ b/phpunit/deprecated-searchoptions/Computer_SoftwareVersion.json @@ -27,8 +27,7 @@ "contains", "notcontains", "equals", - "notequals", - "matches" + "notequals" ], "uid": "Computer_SoftwareVersion.Computer.name" }, @@ -42,11 +41,11 @@ "available_searchtypes": [ "contains", "notcontains", + "matches", "equals", "notequals", - "matches", "empty" ], "uid": "Computer_SoftwareVersion.SoftwareVersion.name" } -} \ No newline at end of file +} diff --git a/phpunit/deprecated-searchoptions/TicketFollowup.json b/phpunit/deprecated-searchoptions/TicketFollowup.json index 2f5d15c3987..2569f703b09 100644 --- a/phpunit/deprecated-searchoptions/TicketFollowup.json +++ b/phpunit/deprecated-searchoptions/TicketFollowup.json @@ -24,8 +24,7 @@ "available_searchtypes": [ "contains", "equals", - "notequals", - "matches" + "notequals" ], "uid": "TicketFollowup.RequestType.name" }, @@ -69,8 +68,7 @@ "available_searchtypes": [ "contains", "equals", - "notequals", - "matches" + "notequals" ], "uid": "TicketFollowup.User.name" }, From 12c9b53473e41797c7aa7910d43ea7feacef956a Mon Sep 17 00:00:00 2001 From: hyunah-jang_kyndryl Date: Tue, 9 Sep 2025 09:34:07 +0900 Subject: [PATCH 09/11] test: fix matches search option test to use field 1 and ensure exact match (SQL '=') --- phpunit/functional/SearchTest.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/phpunit/functional/SearchTest.php b/phpunit/functional/SearchTest.php index 87c19a6a901..b0e6d1fb4d8 100644 --- a/phpunit/functional/SearchTest.php +++ b/phpunit/functional/SearchTest.php @@ -1061,8 +1061,13 @@ public function testMatchesSearchOption() $search_params = [ 'is_deleted' => 0, 'start' => 0, - 'matches' => $name, - 'criteria' => [], + 'criteria' => [ + [ + 'field' => '1', // name + 'searchtype' => 'matches', + 'value' => $name, + ], + ], ]; $data = $this->doSearch($class, $search_params); From bfecb7993219da8ecf1932ac2fb5f091f11f9173 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Tue, 9 Sep 2025 07:53:49 +0200 Subject: [PATCH 10/11] =?UTF-8?q?Add=20tests=20propoosed=20by=20C=C3=A9dri?= =?UTF-8?q?c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpunit/functional/SearchTest.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/phpunit/functional/SearchTest.php b/phpunit/functional/SearchTest.php index b0e6d1fb4d8..5418566b6dc 100644 --- a/phpunit/functional/SearchTest.php +++ b/phpunit/functional/SearchTest.php @@ -2613,6 +2613,16 @@ public static function providerAddWhere() 'meta' => false, 'expected' => "(`glpi_users_users_id_supervisor`.`id` = '5')", ], + [ + 'link' => ' ', + 'nott' => 0, + 'itemtype' => User::class, + 'ID' => 99, + 'searchtype' => 'matches', + 'val' => 'glpi', + 'meta' => false, + 'expected' => "(`glpi_users_users_id_supervisor`.`name` = 'glpi')", + ], [ 'link' => ' AND ', 'nott' => 0, @@ -2693,6 +2703,16 @@ public static function providerAddWhere() 'meta' => false, 'expected' => "AND (INET_ATON(`glpi_ipaddresses`.`name`) < INET_ATON('192.168.1.10'))", ], + [ + 'link' => ' AND ', + 'nott' => 0, + 'itemtype' => \NetworkName::class, + 'ID' => 13, // Search ID 13 (IPAddress name field) + 'searchtype' => 'matches', + 'val' => '192.168.1.10', + 'meta' => false, + 'expected' => "AND (`glpi_ipaddresses`.`name` = '192.168.1.10')", + ], [ 'link' => ' AND ', 'nott' => 0, @@ -2713,6 +2733,16 @@ public static function providerAddWhere() 'meta' => false, 'expected' => "((`glpi_computers`.`name` = '') OR `glpi_computers`.`name` IS NULL)", ], + [ + 'link' => ' ', + 'nott' => 0, + 'itemtype' => Computer::class, + 'ID' => 1, + 'searchtype' => 'matches', + 'val' => 'My computer', + 'meta' => false, + 'expected' => "(`glpi_computers`.`name` = 'My computer')", + ], ]; } From 3a43c46fa374dff0470b461d5ffc0720fad9dd49 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Tue, 9 Sep 2025 10:56:32 +0200 Subject: [PATCH 11/11] Try to fix --- src/Glpi/Search/Provider/SQLProvider.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Glpi/Search/Provider/SQLProvider.php b/src/Glpi/Search/Provider/SQLProvider.php index 528c7aa05da..c61d1e04ae0 100644 --- a/src/Glpi/Search/Provider/SQLProvider.php +++ b/src/Glpi/Search/Provider/SQLProvider.php @@ -1439,6 +1439,9 @@ public static function getWhereCriteria($nott, $itemtype, $ID, $searchtype, $val $criteria['OR'][] = ["$table.id" => null]; } + return $criteria; + } elseif ($searchtype === 'matches') { + $append_criterion_with_search($criteria['OR'], "$table.$field"); return $criteria; } return [new QueryExpression(self::makeTextCriteria("`$table`.`$field`", $val, $nott, ''))]; @@ -1826,7 +1829,7 @@ public static function getWhereCriteria($nott, $itemtype, $ID, $searchtype, $val // Condition will be handled by the subquery break; } - if (in_array($searchtype, ['equals', 'notequals', 'under', 'notunder', 'empty'])) { + if (in_array($searchtype, ['equals', 'notequals', 'under', 'notunder', 'empty', 'matches'])) { if ($searchtype === 'empty' && $opt["field"] === 'name') { $l = $nott ? 'AND' : 'OR'; $criteria = [ @@ -1837,6 +1840,9 @@ public static function getWhereCriteria($nott, $itemtype, $ID, $searchtype, $val ], ]; $append_criterion_with_search($criteria[$l], $tocompute); + } elseif ($searchtype === 'matches') { + $criteria = []; + $append_criterion_with_search($criteria, $tocompute); } else { $criteria = []; $append_criterion_with_search($criteria, "$table.id"); @@ -2253,13 +2259,14 @@ public static function getWhereCriteria($nott, $itemtype, $ID, $searchtype, $val } // Default case - if (in_array($searchtype, ['equals', 'notequals','under', 'notunder'])) { + if (in_array($searchtype, ['equals', 'notequals','under', 'notunder', 'matches'])) { $criteria = ['OR' => []]; if ( (!isset($opt['searchequalsonfield']) || !$opt['searchequalsonfield']) && ($itemtype == AllAssets::getType() || $table != $itemtype::getTable()) + && $searchtype !== 'matches' ) { $append_criterion_with_search($criteria['OR'], "$table.id"); } else {