diff --git a/src/Utils/SearchTermPart.php b/src/Utils/SearchTermPart.php index d5b4558d..e9f71599 100644 --- a/src/Utils/SearchTermPart.php +++ b/src/Utils/SearchTermPart.php @@ -18,7 +18,7 @@ final class SearchTermPart public function __construct(string $term) { if (str_contains($term, ':')) { - $tmp = explode(':', $term); + $tmp = explode(':', $term, 2); // search strings like 'name:' are NOT field searches, but simply terms with a colon if (\count($tmp) === 2 && $tmp[1] !== '') { $this->field = $tmp[0]; diff --git a/tests/Utils/SearchTermPartTest.php b/tests/Utils/SearchTermPartTest.php index 156e2a68..7ed1383f 100644 --- a/tests/Utils/SearchTermPartTest.php +++ b/tests/Utils/SearchTermPartTest.php @@ -27,6 +27,8 @@ class SearchTermPartTest extends TestCase ['bar', 'bar', null, false], ['hello:world', 'world', 'hello', false], ['hello:!world', 'world', 'hello', true], + ['url:https://www.example.com', 'https://www.example.com', 'url', false], + ['url:!https://www.example.com:8080/test.html', 'https://www.example.com:8080/test.html', 'url', true], ]; }