summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-03-20 14:41:31 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2015-03-21 13:36:50 +0100
commit953b030e2678ce45d2f182c181ef2190f39d161d (patch)
tree0337988efca9bf3b714ca9af5e95e188d6ddb260 /db
parent03ce3af3a51f51852cd0a3f06872fc36d7f62dfb (diff)
generate an index
Diffstat (limited to 'db')
-rw-r--r--db/feedmapper.php6
-rw-r--r--db/foldermapper.php6
-rw-r--r--db/item.php11
-rw-r--r--db/itemmapper.php4
-rw-r--r--db/mapperfactory.php4
-rw-r--r--db/mysql/itemmapper.php6
-rw-r--r--db/newsmapper.php8
7 files changed, 28 insertions, 17 deletions
diff --git a/db/feedmapper.php b/db/feedmapper.php
index 0d00057d3..479cead28 100644
--- a/db/feedmapper.php
+++ b/db/feedmapper.php
@@ -13,14 +13,14 @@
namespace OCA\News\Db;
-use \OCP\IDb;
-use \OCP\AppFramework\Db\Entity;
+use OCP\IDBConnection;
+use OCP\AppFramework\Db\Entity;
class FeedMapper extends NewsMapper {
- public function __construct(IDb $db) {
+ public function __construct(IDBConnection $db) {
parent::__construct($db, 'news_feeds', '\OCA\News\Db\Feed');
}
diff --git a/db/foldermapper.php b/db/foldermapper.php
index f2a2ff68d..867e05493 100644
--- a/db/foldermapper.php
+++ b/db/foldermapper.php
@@ -13,12 +13,12 @@
namespace OCA\News\Db;
-use \OCP\IDb;
-use \OCP\AppFramework\Db\Entity;
+use OCP\IDBConnection;
+use OCP\AppFramework\Db\Entity;
class FolderMapper extends NewsMapper {
- public function __construct(IDb $db) {
+ public function __construct(IDBConnection $db) {
parent::__construct($db, 'news_folders', '\OCA\News\Db\Folder');
}
diff --git a/db/item.php b/db/item.php
index 24cc45de1..8c555db86 100644
--- a/db/item.php
+++ b/db/item.php
@@ -57,6 +57,7 @@ class Item extends Entity implements IAPI, \JsonSerializable {
protected $feedId;
protected $status = 0;
protected $lastModified;
+ protected $searchIndex;
public function __construct(){
$this->addType('pubDate', 'integer');
@@ -196,6 +197,16 @@ class Item extends Entity implements IAPI, \JsonSerializable {
parent::setTitle(strip_tags($title));
}
+ public function generateSearchIndex() {
+ $this->setSearchIndex(
+ strtolower(
+ strip_tags($this->getBody()) .
+ $this->getAuthor() .
+ $this->getTitle() .
+ $this->getUrl()
+ )
+ );
+ }
public function setUrl($url) {
$url = trim($url);
diff --git a/db/itemmapper.php b/db/itemmapper.php
index a41ecfd66..cc34ddd9d 100644
--- a/db/itemmapper.php
+++ b/db/itemmapper.php
@@ -13,12 +13,12 @@
namespace OCA\News\Db;
-use \OCP\IDb;
+use \OCP\IDBConnection;
class ItemMapper extends NewsMapper {
- public function __construct(IDb $db){
+ public function __construct(IDBConnection $db){
parent::__construct($db, 'news_items', '\OCA\News\Db\Item');
}
diff --git a/db/mapperfactory.php b/db/mapperfactory.php
index 0b26574dc..6704842e4 100644
--- a/db/mapperfactory.php
+++ b/db/mapperfactory.php
@@ -13,7 +13,7 @@
namespace OCA\News\Db;
-use \OCP\IDb;
+use \OCP\IDBConnection;
use \OCA\News\Db\Mysql\ItemMapper as MysqlItemMapper;
class MapperFactory {
@@ -21,7 +21,7 @@ class MapperFactory {
private $dbType;
private $db;
- public function __construct($DatabaseType, IDb $db) {
+ public function __construct($DatabaseType, IDBConnection $db) {
$this->dbType = $DatabaseType;
$this->db = $db;
}
diff --git a/db/mysql/itemmapper.php b/db/mysql/itemmapper.php
index c58036350..61d32a821 100644
--- a/db/mysql/itemmapper.php
+++ b/db/mysql/itemmapper.php
@@ -13,14 +13,14 @@
namespace OCA\News\Db\Mysql;
-use \OCP\IDb;
+use OCP\IDBConnection;
-use \OCA\News\Db\StatusFlag;
+use OCA\News\Db\StatusFlag;
class ItemMapper extends \OCA\News\Db\ItemMapper {
- public function __construct(IDb $db){
+ public function __construct(IDBConnection $db){
parent::__construct($db);
}
diff --git a/db/newsmapper.php b/db/newsmapper.php
index c483bd329..d946a28a6 100644
--- a/db/newsmapper.php
+++ b/db/newsmapper.php
@@ -13,13 +13,13 @@
namespace OCA\News\Db;
-use \OCP\IDb;
-use \OCP\AppFramework\Db\Entity;
-use \OCP\AppFramework\Db\Mapper;
+use OCP\IDBConnection;
+use OCP\AppFramework\Db\Entity;
+use OCP\AppFramework\Db\Mapper;
abstract class NewsMapper extends Mapper {
- public function __construct(IDb $db, $table, $entity) {
+ public function __construct(IDBConnection $db, $table, $entity) {
parent::__construct($db, $table, $entity);
}