fix searchterm parsing (#5501)
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user