aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Search.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/Search.php')
-rw-r--r--app/Models/Search.php44
1 files changed, 42 insertions, 2 deletions
diff --git a/app/Models/Search.php b/app/Models/Search.php
index f9cda7354..74264b712 100644
--- a/app/Models/Search.php
+++ b/app/Models/Search.php
@@ -24,6 +24,10 @@ class FreshRSS_Search {
private $search;
private $not_intitle;
+ private $not_min_date;
+ private $not_max_date;
+ private $not_min_pubdate;
+ private $not_max_pubdate;
private $not_inurl;
private $not_author;
private $not_tags;
@@ -37,6 +41,9 @@ class FreshRSS_Search {
$input = preg_replace('/:"(.*?)"/', ':"\1"', $input);
+ $input = $this->parseNotPubdateSearch($input);
+ $input = $this->parseNotDateSearch($input);
+
$input = $this->parseNotIntitleSearch($input);
$input = $this->parseNotAuthorSearch($input);
$input = $this->parseNotInurlSearch($input);
@@ -72,7 +79,9 @@ class FreshRSS_Search {
public function getMinDate() {
return $this->min_date;
}
-
+ public function getNotMinDate() {
+ return $this->not_min_date;
+ }
public function setMinDate($value) {
return $this->min_date = $value;
}
@@ -80,7 +89,9 @@ class FreshRSS_Search {
public function getMaxDate() {
return $this->max_date;
}
-
+ public function getNotMaxDate() {
+ return $this->not_max_date;
+ }
public function setMaxDate($value) {
return $this->max_date = $value;
}
@@ -88,10 +99,16 @@ class FreshRSS_Search {
public function getMinPubdate() {
return $this->min_pubdate;
}
+ public function getNotMinPubdate() {
+ return $this->not_min_pubdate;
+ }
public function getMaxPubdate() {
return $this->max_pubdate;
}
+ public function getNotMaxPubdate() {
+ return $this->not_max_pubdate;
+ }
public function getInurl() {
return $this->inurl;
@@ -257,6 +274,18 @@ class FreshRSS_Search {
return $input;
}
+ private function parseNotDateSearch($input) {
+ if (preg_match_all('/[!-]date:(?P<search>[^\s]*)/', $input, $matches)) {
+ $input = str_replace($matches[0], '', $input);
+ $dates = self::removeEmptyValues($matches['search']);
+ if (!empty($dates[0])) {
+ list($this->not_min_date, $this->not_max_date) = parseDateInterval($dates[0]);
+ }
+ }
+ return $input;
+ }
+
+
/**
* Parse the search string to find pubdate keyword and the search related
* to it.
@@ -276,6 +305,17 @@ class FreshRSS_Search {
return $input;
}
+ private function parseNotPubdateSearch($input) {
+ if (preg_match_all('/[!-]pubdate:(?P<search>[^\s]*)/', $input, $matches)) {
+ $input = str_replace($matches[0], '', $input);
+ $dates = self::removeEmptyValues($matches['search']);
+ if (!empty($dates[0])) {
+ list($this->not_min_pubdate, $this->not_max_pubdate) = parseDateInterval($dates[0]);
+ }
+ }
+ return $input;
+ }
+
/**
* Parse the search string to find tags keyword (# followed by a word)
* and the search related to it.