(backend) add a breadcrumb in the search response

In the search response, we want to display a breadcrumb for every
document returned. For this we added a "parents" property containing a list
documents, all are the parents of the current document (ordered by their
depth). With this we can easily create a breadcrumb.
This commit is contained in:
Manuel Raynaud
2026-05-27 17:41:39 +02:00
parent 31b088c307
commit fdc99adc78
5 changed files with 1416 additions and 6 deletions
@@ -88,7 +88,9 @@ def test_api_documents_search_simple_search_anonymous(settings):
assert response.json()["count"] == 0
def test_api_documents_search_fall_back_on_simple_search(settings):
def test_api_documents_search_fall_back_on_simple_search(
settings, django_assert_num_queries
):
"""
When indexer is not configured the search should be made in the database on the
title field.
@@ -125,7 +127,8 @@ def test_api_documents_search_fall_back_on_simple_search(settings):
client.force_login(user)
q = "alpha"
response = client.get("/api/v1.0/documents/search/", data={"q": q})
with django_assert_num_queries(13):
response = client.get("/api/v1.0/documents/search/", data={"q": q})
assert response.status_code == 200
@@ -371,7 +374,7 @@ def test_api_documents_search_simple_search_only_match_in_depth(settings):
}
def test_api_documents_saerch_with_title_also_matching_link_traces(settings):
def test_api_documents_search_with_title_also_matching_link_traces(settings):
"""Test that link_traces can also be present in the search result."""
assert get_document_indexer() is None
assert settings.OIDC_STORE_REFRESH_TOKEN is False
File diff suppressed because it is too large Load Diff