diff options
| author | 2017-04-01 22:31:12 +0200 | |
|---|---|---|
| committer | 2017-04-01 22:31:12 +0200 | |
| commit | d9c0d25b85ef3df7ea2cdc261e274efcdd5cfce0 (patch) | |
| tree | 6db6cd1a2cca013ab6cc7809ce8ec9fad3e67b73 /app/Models/EntryDAO.php | |
| parent | f98cd52a02eb1e2d17b46ef9fddf327b0ebd55e2 (diff) | |
Improve search: intitle, author, inurl
Allow multiple values of intitle: , author:, inurl:
Note: Tests for UserQueryTest are broken due to
https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-4.0.0#backwards-compatibility-issues
Diffstat (limited to 'app/Models/EntryDAO.php')
| -rw-r--r-- | app/Models/EntryDAO.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 61ec48d08..510755a2f 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -631,16 +631,22 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } if ($filter) { if ($filter->getIntitle()) { - $search .= 'AND ' . $alias . 'title LIKE ? '; - $values[] = "%{$filter->getIntitle()}%"; + foreach ($filter->getIntitle() as $title) { + $search .= 'AND ' . $alias . 'title LIKE ? '; + $values[] = "%{$title}%"; + } } if ($filter->getInurl()) { - $search .= 'AND CONCAT(' . $alias . 'link, ' . $alias . 'guid) LIKE ? '; - $values[] = "%{$filter->getInurl()}%"; + foreach ($filter->getInurl() as $url) { + $search .= 'AND CONCAT(' . $alias . 'link, ' . $alias . 'guid) LIKE ? '; + $values[] = "%{$url}%"; + } } if ($filter->getAuthor()) { - $search .= 'AND ' . $alias . 'author LIKE ? '; - $values[] = "%{$filter->getAuthor()}%"; + foreach ($filter->getAuthor() as $author) { + $search .= 'AND ' . $alias . 'author LIKE ? '; + $values[] = "%{$author}%"; + } } if ($filter->getMinDate()) { $search .= 'AND ' . $alias . 'id >= ? '; @@ -659,8 +665,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $values[] = $filter->getMaxPubdate(); } if ($filter->getTags()) { - $tags = $filter->getTags(); - foreach ($tags as $tag) { + foreach ($filter->getTags() as $tag) { $search .= 'AND ' . $alias . 'tags LIKE ? '; $values[] = "%{$tag}%"; } |
