1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-10-15 19:42:08 +00:00

Added a simple search engine

Fix #18
This commit is contained in:
Nicolas Lœuillet 2016-11-04 23:24:43 +01:00
parent 27dce581ca
commit ee122a7528
15 changed files with 151 additions and 50 deletions

View file

@ -85,6 +85,25 @@ class EntryRepository extends EntityRepository
;
}
/**
* Retrieves entries filtered with a search term for a user.
*
* @param int $userId
* @param string $term
*
* @return QueryBuilder
*/
public function getBuilderForSearchByUser($userId, $term)
{
return $this
->getBuilderByUser($userId)
->andWhere('e.content LIKE :term')->setParameter('term', '%'.$term.'%')
->orWhere('e.title LIKE :term')->setParameter('term', '%'.$term.'%')
->leftJoin('e.tags', 't')
->groupBy('e.id')
->having('count(t.id) = 0');
}
/**
* Retrieves untagged entries for a user.
*