1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 08:17:12 +02:00

Update ProcessPageSearchLive to simplify id searches when using single equals sign

This commit is contained in:
Ryan Cramer
2024-03-01 15:57:20 -05:00
parent 4b55979624
commit 5fe181c315

View File

@@ -303,8 +303,12 @@ class ProcessPageSearchLive extends Wire {
}
if(empty($operator) || !in_array($operator, $this->allowOperators)) {
if(in_array($property, array('id', 'status', 'templates_id', 'parent_id'))) {
$operator = '=';
} else {
$operator = strpos($q, ' ') ? $this->multiWordOperator : $this->singleWordOperator;
}
}
// check if type and property may be part of query: $q
if(empty($type) && empty($property) && strpos($q, ':')) {
@@ -363,6 +367,7 @@ class ProcessPageSearchLive extends Wire {
if($property && ($fields->isNative($property) || $fields->get($property)) && !in_array($lp, $this->skipProperties)) {
// we recognize this property as searchable, so add it to the selector
if($lp == 'status' && !$user->isSuperuser() && $value > Page::statusHidden) $value = Page::statusHidden;
if($lp == 'id' && $operator === $this->liveSearchDefaults['operator']) $operator = '=';
$selectors[] = $property . $operator . $value;
} else {
// we did not recognize the property, so use field(s) defined in module instead