search: index page for cells with external links (#54763)

This commit is contained in:
Serghei Mihai 2021-06-11 10:39:07 +02:00
parent 65da4dd24e
commit d4df555e8b
2 changed files with 8 additions and 0 deletions

View File

@ -96,6 +96,7 @@ def index_site():
indexed_cell = IndexedCell(
cell_type=cell_type,
cell_pk=cell.id,
page_id=cell.page_id,
public_access=bool(cell.page.public and cell.public),
url=link_data['url'],
title=link_data['title'],

View File

@ -528,6 +528,13 @@ def test_search_external_links(app):
assert hits[0]['text'] in ('foobar', 'baz')
assert hits[0]['url'] == 'http://example.net'
# update cell to search content only on its page
cell._search_services = {'data': ['_text_page_%s' % page.slug]}
cell.save()
hits = search_site(request, 'foobar', pages=[page])
assert len(hits) == 1
def test_manager_search_cell(settings, app, admin_user):
page = Page.objects.create(title='One', slug='one', template_name='standard')