From 474edf75e5e2bb000992fe5840fdb2ab414e2b2b Mon Sep 17 00:00:00 2001 From: David Blanc Brioir Date: Thu, 1 Jan 2026 15:42:03 +0100 Subject: [PATCH] fix: Display work/author metadata and improve section titles Backend fix: - Remove return_properties from hierarchical chunk query - Weaviate returns nested objects (work, document) when return_properties is not specified - This allows chunks to have work.author and work.title available Frontend improvements: - Truncate long section titles to 80 chars with ellipsis - Hide section_path if identical to title (avoid duplication) - Work and author badges should now display correctly in chunk metadata --- generations/library_rag/flask_app.py | 5 +---- generations/library_rag/templates/search.html | 6 ++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/generations/library_rag/flask_app.py b/generations/library_rag/flask_app.py index 43d0e7a..2e9cdc4 100644 --- a/generations/library_rag/flask_app.py +++ b/generations/library_rag/flask_app.py @@ -442,15 +442,12 @@ def hierarchical_search( filters = filters & work_filter_obj # Search chunks in this section + # Note: Don't specify return_properties to get nested objects (work, document) chunks_result = chunk_collection.query.near_text( query=query, limit=limit, filters=filters, return_metadata=wvq.MetadataQuery(distance=True), - return_properties=[ - "text", "sectionPath", "sectionLevel", "chapterTitle", - "canonicalReference", "unitType", "keywords", "orderIndex", "language" - ], ) # Add chunks to section diff --git a/generations/library_rag/templates/search.html b/generations/library_rag/templates/search.html index d247415..13a8397 100644 --- a/generations/library_rag/templates/search.html +++ b/generations/library_rag/templates/search.html @@ -178,11 +178,13 @@

- 📂 {{ section.title }} + 📂 {{ section.title[:80] }}{% if section.title|length > 80 %}...{% endif %} {{ section.chunks_count }} passage{% if section.chunks_count > 1 %}s{% endif %} ⚡ {{ section.similarity }}% similaire

-

📍 {{ section.section_path }}

+ {% if section.section_path and section.section_path != section.title %} +

📍 {{ section.section_path }}

+ {% endif %} {% if section.summary_text %}

{{ section.summary_text }}

{% endif %}