Merge pull request #6771 from wallabag/add-annotations-in-search
Add articles which have annotations with search term in results
This commit is contained in:
commit
4b338afa40
@ -133,8 +133,10 @@ class EntryRepository extends ServiceEntityRepository
|
|||||||
|
|
||||||
// We lower() all parts here because PostgreSQL 'LIKE' verb is case-sensitive
|
// We lower() all parts here because PostgreSQL 'LIKE' verb is case-sensitive
|
||||||
$qb
|
$qb
|
||||||
->andWhere('lower(e.content) LIKE lower(:term) OR lower(e.title) LIKE lower(:term) OR lower(e.url) LIKE lower(:term)')->setParameter('term', '%' . $term . '%')
|
->andWhere('lower(e.content) LIKE lower(:term) OR lower(e.title) LIKE lower(:term) OR lower(e.url) LIKE lower(:term) OR lower(a.text) LIKE lower(:term)')
|
||||||
|
->setParameter('term', '%' . $term . '%')
|
||||||
->leftJoin('e.tags', 't')
|
->leftJoin('e.tags', 't')
|
||||||
|
->leftJoin('e.annotations', 'a')
|
||||||
->groupBy('e.id');
|
->groupBy('e.id');
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
|
@ -1499,6 +1499,17 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||||||
$crawler = $client->submit($form, $data);
|
$crawler = $client->submit($form, $data);
|
||||||
|
|
||||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||||
|
|
||||||
|
$crawler = $client->request('GET', '/unread/list');
|
||||||
|
|
||||||
|
$form = $crawler->filter('form[name=search]')->form();
|
||||||
|
$data = [
|
||||||
|
'search_entry[term]' => 'annotation',
|
||||||
|
];
|
||||||
|
|
||||||
|
$crawler = $client->submit($form, $data);
|
||||||
|
|
||||||
|
$this->assertCount(2, $crawler->filter($this->entryDataTestAttribute));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataForLanguage()
|
public function dataForLanguage()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user