miniflux-legacy/app/models/search.php

45 lines
1.1 KiB
PHP
Raw Normal View History

2016-08-19 04:20:49 +02:00
<?php
2016-08-25 03:17:58 +02:00
namespace Miniflux\Model\Search;
2016-08-19 04:20:49 +02:00
use PicoDb\Database;
function count_items($text)
{
return Database::getInstance('db')
->table('items')
->neq('status', 'removed')
->ilike('title', '%' . $text . '%')
->count();
}
function get_all_items($text, $offset = null, $limit = null)
{
return Database::getInstance('db')
->table('items')
->columns(
'items.id',
'items.title',
'items.updated',
'items.url',
'items.enclosure',
'items.enclosure_type',
'items.bookmark',
'items.feed_id',
'items.status',
'items.content',
'items.language',
'items.author',
'feeds.site_url',
'feeds.title AS feed_title',
'feeds.rtl'
)
->join('feeds', 'id', 'feed_id')
->neq('status', 'removed')
->ilike('items.title', '%' . $text . '%')
->orderBy('updated', 'desc')
->offset($offset)
->limit($limit)
->findAll();
}