diff options
author | tcit <tcit@tcit.fr> | 2014-03-22 11:09:18 +0100 |
---|---|---|
committer | tcit <tcit@tcit.fr> | 2014-03-22 11:09:18 +0100 |
commit | a33a3d2afb6a861e194599973e31e5e448617296 (patch) | |
tree | a8c846472db8fabe7cadbaad0f87bb420ce228ae /inc/poche/Database.class.php | |
parent | 028e34b6c40c3571d35c49d5a27b7eac19ceb4ef (diff) | |
download | wallabag-a33a3d2afb6a861e194599973e31e5e448617296.tar.gz wallabag-a33a3d2afb6a861e194599973e31e5e448617296.tar.zst wallabag-a33a3d2afb6a861e194599973e31e5e448617296.zip |
Implemented rudimental search engine
Diffstat (limited to 'inc/poche/Database.class.php')
-rwxr-xr-x | inc/poche/Database.class.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 5b51b507..6aad16c1 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -388,6 +388,14 @@ class Database { | |||
388 | public function getLastId($column = '') { | 388 | public function getLastId($column = '') { |
389 | return $this->getHandle()->lastInsertId($column); | 389 | return $this->getHandle()->lastInsertId($column); |
390 | } | 390 | } |
391 | |||
392 | public function search($term){ | ||
393 | $search = '%'.$term.'%'; | ||
394 | $query = $this->getHandle()->prepare("SELECT * FROM entries WHERE content LIKE ?"); | ||
395 | $query->execute(array($search)); | ||
396 | $entries = $query->fetchAll(); | ||
397 | return $entries; | ||
398 | } | ||
391 | 399 | ||
392 | public function retrieveAllTags($user_id, $term = null) { | 400 | public function retrieveAllTags($user_id, $term = null) { |
393 | $sql = "SELECT DISTINCT tags.*, count(entries.id) AS entriescount FROM tags | 401 | $sql = "SELECT DISTINCT tags.*, count(entries.id) AS entriescount FROM tags |