diff --git a/core/dbobjectsearch.class.php b/core/dbobjectsearch.class.php
index 27e5f6436..50f674758 100644
--- a/core/dbobjectsearch.class.php
+++ b/core/dbobjectsearch.class.php
@@ -480,6 +480,11 @@ class DBObjectSearch extends DBSearch
$oNewCondition = Expression::FromOQL($sOQLCondition);
break;
+ case 'MATCHES':
+ $oRightExpr = new ScalarExpression($value);
+ $oNewCondition = new MatchExpression($oField, $oRightExpr);
+ break;
+
case 'Contains':
case 'Begins with':
case 'Finishes with':
diff --git a/test/core/DBSearchCommitTest.php b/test/core/DBSearchCommitTest.php
new file mode 100644
index 000000000..267b723a6
--- /dev/null
+++ b/test/core/DBSearchCommitTest.php
@@ -0,0 +1,93 @@
+
+ *
MakeGroupByQuery
+ *
+ *
+ * @runTestsInSeparateProcesses
+ * @preserveGlobalState disabled
+ * @backupGlobals disabled
+ */
+class DBSearchCommitTest extends ItopDataTestCase
+{
+ // Need database COMMIT in order to create the FULLTEXT INDEX of MySQL
+ const USE_TRANSACTION = false;
+
+ /**
+ * @throws \CoreException
+ * @throws \CoreUnexpectedValue
+ * @throws \MissingQueryArgument
+ * @throws \MySQLException
+ * @throws \MySQLHasGoneAwayException
+ * @throws \OQLException
+ * @throws \Exception
+ */
+ public function testAttributeTagSet()
+ {
+ // Create a tag
+ $this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag1', 'UNIT First');
+ $this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag2', 'UNIT Second');
+ //Use it
+ $oTicket = $this->CreateTicket(1);
+ $oTicket->Set(TAG_ATTCODE, 'tag1');
+ $oTicket->DBWrite();
+
+ $oSearch = DBSearch::FromOQL("SELECT UserRequest");
+ $oSearch->AddCondition(TAG_ATTCODE, 'tag1', 'MATCHES');
+ $oSet = new \DBObjectSet($oSearch);
+ static::assertEquals(1, $oSet->Count());
+
+
+ $oTicket->Set(TAG_ATTCODE, 'tag1 tag2');
+ $oTicket->DBWrite();
+
+ $oSet = new \DBObjectSet($oSearch);
+ static::assertEquals(1, $oSet->Count());
+ }
+
+ /**
+ * @throws \CoreException
+ * @throws \CoreUnexpectedValue
+ * @throws \MissingQueryArgument
+ * @throws \MySQLException
+ * @throws \MySQLHasGoneAwayException
+ * @throws \OQLException
+ * @throws \Exception
+ */
+ public function testAttributeTagSet2()
+ {
+ // Create a tag
+ $this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag1', 'UNIT First');
+ $this->CreateTagData(TAG_CLASS, TAG_ATTCODE, 'tag2', 'UNIT Second');
+ //Use it
+ $oTicket = $this->CreateTicket(1);
+ $oTicket->Set(TAG_ATTCODE, 'tag1');
+ $oTicket->DBWrite();
+
+ $oSearch = DBSearch::FromOQL("SELECT UserRequest");
+ $oSearch->AddCondition(TAG_ATTCODE, 'tag1');
+ $oSet = new \DBObjectSet($oSearch);
+ static::assertEquals(1, $oSet->Count());
+
+
+ $oTicket->Set(TAG_ATTCODE, 'tag1 tag2');
+ $oTicket->DBWrite();
+
+ $oSet = new \DBObjectSet($oSearch);
+ static::assertEquals(0, $oSet->Count());
+ }
+
+}