aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/EntryRepository.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-04 23:24:43 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-19 19:17:30 +0100
commitee122a7528f55dfb5f02e351c509d00b756fedaa (patch)
treeb4b134dc00dda3394a1ab01408369803c8b0b889 /src/Wallabag/CoreBundle/Repository/EntryRepository.php
parent27dce581caba158a8ffffa5bc30648a21f47da12 (diff)
downloadwallabag-ee122a7528f55dfb5f02e351c509d00b756fedaa.tar.gz
wallabag-ee122a7528f55dfb5f02e351c509d00b756fedaa.tar.zst
wallabag-ee122a7528f55dfb5f02e351c509d00b756fedaa.zip
Added a simple search engine
Fix #18
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 61be5220..8f23164f 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -86,6 +86,25 @@ class EntryRepository extends EntityRepository
86 } 86 }
87 87
88 /** 88 /**
89 * Retrieves entries filtered with a search term for a user.
90 *
91 * @param int $userId
92 * @param string $term
93 *
94 * @return QueryBuilder
95 */
96 public function getBuilderForSearchByUser($userId, $term)
97 {
98 return $this
99 ->getBuilderByUser($userId)
100 ->andWhere('e.content LIKE :term')->setParameter('term', '%'.$term.'%')
101 ->orWhere('e.title LIKE :term')->setParameter('term', '%'.$term.'%')
102 ->leftJoin('e.tags', 't')
103 ->groupBy('e.id')
104 ->having('count(t.id) = 0');
105 }
106
107 /**
89 * Retrieves untagged entries for a user. 108 * Retrieves untagged entries for a user.
90 * 109 *
91 * @param int $userId 110 * @param int $userId