diff options
| author | 2025-08-27 21:56:10 +0200 | |
|---|---|---|
| committer | 2025-08-27 21:56:10 +0200 | |
| commit | 288992d9ad64c52b77983e27f497aa6f4ed5728e (patch) | |
| tree | 4364722b2efcab1504e5a3dfec9f9f0082513a9d /app/Models/Search.php | |
| parent | 70f0d6d24f217ef4952225f8f57d2f86f7eb96bc (diff) | |
Fix logic for searching labels (#7863)
`L:1 L:2` is supposed to be an implicit `AND`,
while `L:1,2` as well as `L:1 OR L:2` is an `OR` logic
Diffstat (limited to 'app/Models/Search.php')
| -rw-r--r-- | app/Models/Search.php | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/app/Models/Search.php b/app/Models/Search.php index 68f0a6bce..539fe2a12 100644 --- a/app/Models/Search.php +++ b/app/Models/Search.php @@ -23,9 +23,9 @@ class FreshRSS_Search implements \Stringable { private ?array $feed_ids = null; /** @var list<int>|null */ private ?array $category_ids = null; - /** @var list<int>|'*'|null */ + /** @var list<list<int>|'*'>|null */ private $label_ids = null; - /** @var list<string>|null */ + /** @var list<list<string>>|null */ private ?array $label_names = null; /** @var list<string>|null */ private ?array $intitle = null; @@ -66,9 +66,9 @@ class FreshRSS_Search implements \Stringable { private ?array $not_feed_ids = null; /** @var list<int>|null */ private ?array $not_category_ids = null; - /** @var list<int>|'*'|null */ + /** @var list<list<int>|'*'>|null */ private $not_label_ids = null; - /** @var list<string>|null */ + /** @var list<list<string>>|null */ private ?array $not_label_names = null; /** @var list<string>|null */ private ?array $not_intitle = null; @@ -180,19 +180,19 @@ class FreshRSS_Search implements \Stringable { return $this->not_category_ids; } - /** @return list<int>|'*'|null */ - public function getLabelIds(): array|string|null { + /** @return list<list<int>|'*'>|null */ + public function getLabelIds(): array|null { return $this->label_ids; } - /** @return list<int>|'*'|null */ - public function getNotLabelIds(): array|string|null { + /** @return list<list<int>|'*'>|null */ + public function getNotLabelIds(): array|null { return $this->not_label_ids; } - /** @return list<string>|null */ + /** @return list<list<string>>|null */ public function getLabelNames(): ?array { return $this->label_names; } - /** @return list<string>|null */ + /** @return list<list<string>>|null */ public function getNotLabelNames(): ?array { return $this->not_label_names; } @@ -481,7 +481,7 @@ class FreshRSS_Search implements \Stringable { $this->label_ids = []; foreach ($ids_lists as $ids_list) { if ($ids_list === '*') { - $this->label_ids = '*'; + $this->label_ids[] = '*'; break; } $label_ids = explode(',', $ids_list); @@ -489,7 +489,7 @@ class FreshRSS_Search implements \Stringable { /** @var list<int> $label_ids */ $label_ids = array_map('intval', $label_ids); if (!empty($label_ids)) { - $this->label_ids = array_merge($this->label_ids, $label_ids); + $this->label_ids[] = $label_ids; } } } @@ -503,7 +503,7 @@ class FreshRSS_Search implements \Stringable { $this->not_label_ids = []; foreach ($ids_lists as $ids_list) { if ($ids_list === '*') { - $this->not_label_ids = '*'; + $this->not_label_ids[] = '*'; break; } $label_ids = explode(',', $ids_list); @@ -511,7 +511,7 @@ class FreshRSS_Search implements \Stringable { /** @var list<int> $label_ids */ $label_ids = array_map('intval', $label_ids); if (!empty($label_ids)) { - $this->not_label_ids = array_merge($this->not_label_ids, $label_ids); + $this->not_label_ids[] = $label_ids; } } } @@ -537,7 +537,7 @@ class FreshRSS_Search implements \Stringable { $names_array = explode(',', $names_list); $names_array = self::removeEmptyValues($names_array); if (!empty($names_array)) { - $this->label_names = array_merge($this->label_names, $names_array); + $this->label_names[] = $names_array; } } } @@ -563,7 +563,7 @@ class FreshRSS_Search implements \Stringable { $names_array = explode(',', $names_list); $names_array = self::removeEmptyValues($names_array); if (!empty($names_array)) { - $this->not_label_names = array_merge($this->not_label_names, $names_array); + $this->not_label_names[] = $names_array; } } } |
