Root cause:
- Summary.sectionPath: '635. As for the subject...' (paragraph numbers)
- Chunk.sectionPath: 'Peirce: CP 4.47 > 47. §3 THE NATURE...' (canonical refs)
- No way to match them with prefix/equal filters
Solution (workaround until summaries are regenerated):
- Show sections as **context** (relevant high-level topics found)
- Show chunks **globally** (top 20 most relevant passages)
- Don't try to group chunks under sections
UI changes:
- '📚 Sections pertinentes trouvées' (context cards with summary)
- '📄 Passages les plus pertinents' (top chunks, not grouped)
- Cleaner, more honest representation of what we found
Next steps to fully fix:
- Regenerate Summary collection with correct sectionPath format
- Or create a mapping between Summary titles and Chunk sectionPaths
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
Hierarchical search improvements:
- Display author and work for each chunk using badge-author and badge-work
- Show section hierarchy (sectionPath) in chunk metadata
- Add 📍 icon for section path in headers
Color alignment with charter:
- Replace Bootstrap colors (#007bff, #28a745, #6c757d) with charter variables
- section-group: border and shadow use accent colors (125,110,88)
- section-header: border uses var(--color-accent)
- chunk-item: border-left uses var(--color-accent-alt)
- Mode badges: hierarchical=accent-alt, simple=accent
- Concept badges: subtle beige background with accent border
- Alert boxes: beige background instead of yellow
Visual improvements:
- Add hover transform effect on chunks (translateX)
- Smoother color transitions using CSS variables
## Changes
Allow users to force hierarchical search mode without fallback to simple
search, enabling testing of hierarchical UI even when 0 summaries are found.
**Backend (flask_app.py):**
- Added `force_hierarchical` parameter to `hierarchical_search()`
- When True, never fallback to simple search (return empty hierarchical result)
- Added `fallback_reason` field to explain why no results
- Pass `force_hierarchical=True` when `force_mode == "hierarchical"`
- Applied to all fallback points:
- No Weaviate client
- No summaries found in Stage 1
- No sections after author/work filtering
- Exception during search
**Frontend (templates/search.html):**
- Display warning message when `fallback_reason` exists
- Yellow alert box with explanation and suggestions
- Works even when `results_data.results` is empty
## Usage
1. Select "🌳 Hiérarchique (2-étapes)" in Mode dropdown
2. Enter any query (even if no matching summaries)
3. See hierarchical UI with warning instead of fallback
## Example
Query: "Qu'est-ce que la justice ?" (not in Peirce corpus)
- Mode forced: Hierarchical
- Result: 0 sections, warning displayed
- No silent fallback to simple search
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>