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
This commit is contained in:
@@ -442,15 +442,12 @@ def hierarchical_search(
|
|||||||
filters = filters & work_filter_obj
|
filters = filters & work_filter_obj
|
||||||
|
|
||||||
# Search chunks in this section
|
# Search chunks in this section
|
||||||
|
# Note: Don't specify return_properties to get nested objects (work, document)
|
||||||
chunks_result = chunk_collection.query.near_text(
|
chunks_result = chunk_collection.query.near_text(
|
||||||
query=query,
|
query=query,
|
||||||
limit=limit,
|
limit=limit,
|
||||||
filters=filters,
|
filters=filters,
|
||||||
return_metadata=wvq.MetadataQuery(distance=True),
|
return_metadata=wvq.MetadataQuery(distance=True),
|
||||||
return_properties=[
|
|
||||||
"text", "sectionPath", "sectionLevel", "chapterTitle",
|
|
||||||
"canonicalReference", "unitType", "keywords", "orderIndex", "language"
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add chunks to section
|
# Add chunks to section
|
||||||
|
|||||||
@@ -178,11 +178,13 @@
|
|||||||
<div class="section-group">
|
<div class="section-group">
|
||||||
<div class="section-header">
|
<div class="section-header">
|
||||||
<h3 style="margin: 0 0 0.5rem 0; font-size: 1.3em;">
|
<h3 style="margin: 0 0 0.5rem 0; font-size: 1.3em;">
|
||||||
📂 {{ section.title }}
|
📂 {{ section.title[:80] }}{% if section.title|length > 80 %}...{% endif %}
|
||||||
<span class="badge" style="background-color: var(--color-accent-alt); color: white; margin-left: 0.5rem;">{{ section.chunks_count }} passage{% if section.chunks_count > 1 %}s{% endif %}</span>
|
<span class="badge" style="background-color: var(--color-accent-alt); color: white; margin-left: 0.5rem;">{{ section.chunks_count }} passage{% if section.chunks_count > 1 %}s{% endif %}</span>
|
||||||
<span class="badge badge-similarity" style="margin-left: 0.5rem;">⚡ {{ section.similarity }}% similaire</span>
|
<span class="badge badge-similarity" style="margin-left: 0.5rem;">⚡ {{ section.similarity }}% similaire</span>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="text-muted" style="margin: 0.25rem 0; font-size: 0.9em;">📍 {{ section.section_path }}</p>
|
{% if section.section_path and section.section_path != section.title %}
|
||||||
|
<p class="text-muted" style="margin: 0.25rem 0; font-size: 0.9em;">📍 {{ section.section_path }}</p>
|
||||||
|
{% endif %}
|
||||||
{% if section.summary_text %}
|
{% if section.summary_text %}
|
||||||
<p class="summary-text" style="margin: 0.5rem 0; font-style: italic; color: #555;">{{ section.summary_text }}</p>
|
<p class="summary-text" style="margin: 0.5rem 0; font-style: italic; color: #555;">{{ section.summary_text }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user