sojorn/_legacy/supabase/CREATE_SEARCH_VIEW.md
Patrick Britton 3c4680bdd7 Initial commit: Complete threaded conversation system with inline replies
**Major Features Added:**
- **Inline Reply System**: Replace compose screen with inline reply boxes
- **Thread Navigation**: Parent/child navigation with jump functionality
- **Chain Flow UI**: Reply counts, expand/collapse animations, visual hierarchy
- **Enhanced Animations**: Smooth transitions, hover effects, micro-interactions

 **Frontend Changes:**
- **ThreadedCommentWidget**: Complete rewrite with animations and navigation
- **ThreadNode Model**: Added parent references and descendant counting
- **ThreadedConversationScreen**: Integrated navigation handlers
- **PostDetailScreen**: Replaced with threaded conversation view
- **ComposeScreen**: Added reply indicators and context
- **PostActions**: Fixed visibility checks for chain buttons

 **Backend Changes:**
- **API Route**: Added /posts/:id/thread endpoint
- **Post Repository**: Include allow_chain and visibility fields in feed
- **Thread Handler**: Support for fetching post chains

 **UI/UX Improvements:**
- **Reply Context**: Clear indication when replying to specific posts
- **Character Counting**: 500 character limit with live counter
- **Visual Hierarchy**: Depth-based indentation and styling
- **Smooth Animations**: SizeTransition, FadeTransition, hover states
- **Chain Navigation**: Parent/child buttons with visual feedback

 **Technical Enhancements:**
- **Animation Controllers**: Proper lifecycle management
- **State Management**: Clean separation of concerns
- **Navigation Callbacks**: Reusable navigation system
- **Error Handling**: Graceful fallbacks and user feedback

This creates a Reddit-style threaded conversation experience with smooth
animations, inline replies, and intuitive navigation between posts in a chain.
2026-01-30 07:40:19 -06:00

62 lines
1.5 KiB
Markdown

# Create Search Tags View
The search function requires a database view called `view_searchable_tags` for efficient tag searching.
## Why This Is Needed
Without this view, the search function would need to download ALL posts from the database just to count tags, which will:
- Timeout with 1000+ posts
- Crash the Edge Function
- Cause poor performance
The view pre-aggregates tag counts at the database level, making searches instant.
## How to Create the View
### Option 1: Via Supabase Dashboard (Recommended)
1. Go to your Supabase project's SQL Editor:
https://supabase.com/dashboard/project/zwkihedetedlatyvplyz/sql
2. Paste and run this SQL:
```sql
CREATE OR REPLACE VIEW view_searchable_tags AS
SELECT
unnest(tags) as tag,
COUNT(*) as count
FROM posts
WHERE
deleted_at IS NULL
AND tags IS NOT NULL
AND array_length(tags, 1) > 0
GROUP BY unnest(tags)
ORDER BY count DESC;
```
3. Click "RUN" to execute
### Option 2: Via PowerShell (if you have psql installed)
Run this from the project root:
```powershell
Get-Content supabase\migrations\create_searchable_tags_view.sql | psql $DATABASE_URL
```
Replace `$DATABASE_URL` with your Supabase database connection string.
## Verifying It Works
After creating the view, test it with:
```sql
SELECT * FROM view_searchable_tags LIMIT 10;
```
You should see a list of tags with their counts.
## What Happens If You Don't Create It?
The search function will return an error when searching for tags. Users and posts will still work fine, but tag search will fail until this view is created.