aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-06-29 11:09:08 +0200
committerGravatar GitHub <noreply@github.com> 2025-06-29 11:09:08 +0200
commitc8bbf355342985c83054c6c36c6538a780ab509e (patch)
tree87286cac4e98769b3a14308e042abdd4d83153e4 /app/Models/EntryDAO.php
parent7c57f38008136202ba7b38e3154ac87be4eefb68 (diff)
Add search operator `c:` for categories (#7696)
* Add search operator `c:` for categories fix https://github.com/FreshRSS/FreshRSS/discussions/7692 Allow searching for e.g. `c:23,34`
Diffstat (limited to 'app/Models/EntryDAO.php')
-rw-r--r--app/Models/EntryDAO.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index 68746c380..fecf02cf8 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -917,6 +917,25 @@ SQL;
$sub_search .= ') ';
}
+ if ($filter->getCategoryIds() !== null) {
+ $sub_search .= 'AND ' . $alias . 'id_feed IN (SELECT f.id FROM `_feed` f WHERE f.category IN (';
+ foreach ($filter->getCategoryIds() as $category_id) {
+ $sub_search .= '?,';
+ $values[] = $category_id;
+ }
+ $sub_search = rtrim($sub_search, ',');
+ $sub_search .= ')) ';
+ }
+ if ($filter->getNotCategoryIds() !== null) {
+ $sub_search .= 'AND ' . $alias . 'id_feed NOT IN (SELECT f.id FROM `_feed` f WHERE f.category IN (';
+ foreach ($filter->getNotCategoryIds() as $category_id) {
+ $sub_search .= '?,';
+ $values[] = $category_id;
+ }
+ $sub_search = rtrim($sub_search, ',');
+ $sub_search .= ')) ';
+ }
+
if ($filter->getLabelIds() !== null) {
if ($filter->getLabelIds() === '*') {
$sub_search .= 'AND EXISTS (SELECT et.id_tag FROM `_entrytag` et WHERE et.id_entry = ' . $alias . 'id) ';