This commit is contained in:
James Cole
2019-09-15 08:38:17 +02:00
parent 412b914f66
commit 595a90cb0a

View File

@@ -121,11 +121,11 @@ class Search implements SearchInterface
*/ */
public function parseQuery(string $query): void public function parseQuery(string $query): void
{ {
$filteredQuery = $query; $filteredQuery = app('steam')->cleanString($query);
$this->originalQuery = $query; $this->originalQuery = $filteredQuery;
$pattern = '/[a-z_]*:[0-9a-z-.]*/i'; $pattern = '/[[:alpha:]_]*:"?[\p{L}_-]*"?/ui';
$matches = []; $matches = [];
preg_match_all($pattern, $query, $matches); preg_match_all($pattern, $filteredQuery, $matches);
foreach ($matches[0] as $match) { foreach ($matches[0] as $match) {
$this->extractModifier($match); $this->extractModifier($match);
@@ -314,6 +314,7 @@ class Search implements SearchInterface
if (2 === count($parts) && '' !== trim((string)$parts[1]) && '' !== trim((string)$parts[0])) { if (2 === count($parts) && '' !== trim((string)$parts[1]) && '' !== trim((string)$parts[0])) {
$type = trim((string)$parts[0]); $type = trim((string)$parts[0]);
$value = trim((string)$parts[1]); $value = trim((string)$parts[1]);
$value = trim(trim($value, '"\''));
if (in_array($type, $this->validModifiers, true)) { if (in_array($type, $this->validModifiers, true)) {
// filter for valid type // filter for valid type
$this->modifiers->push(['type' => $type, 'value' => $value]); $this->modifiers->push(['type' => $type, 'value' => $value]);