QUICK_REFERENCE_CARD.md 4.1 KB

Quick Reference: Indexing & Duplicate Detection

Web UI Quick Access

Page URL Purpose
Index Management /indexing Index destinations, view stats
Duplicates /duplicates Review and manage duplicates

Index Management Page Actions

1. Select Dataset → 2. Enter Path → 3. Click "Index" → 4. View Stats

Buttons:

  • 🟦 Index - Add new files to index
  • 🟧 Re-index - Clear and rebuild index
  • Clear Index - Remove all indexed files
  • 🟪 Manage Index (on Duplicates page) - Quick access

CLI Quick Reference

Indexing Commands

# Index destination
index:destination --dataset <name> --destination <path> [--reindex] [--batch-size <n>]

# View statistics
index:stats [--dataset <name>]

# Check count
index:count --dataset <name> [--destination <path>]

# Clear index
index:clear --dataset <name> [--destination <path>]

Duplicate Commands

# Scan for duplicates
duplicates:scan [--reset]

# List duplicates
duplicates:list [--status <status>] [--dataset <name>]

Common Workflows

Initial Setup (CLI)

# 1. Index
watch-finished-cli index:destination --dataset movies --destination /media/movies

# 2. Verify
watch-finished-cli index:count --dataset movies

# 3. Scan
watch-finished-cli duplicates:scan

# 4. View
watch-finished-cli duplicates:list --dataset movies

Initial Setup (Web UI)

1. Navigate to /indexing
2. Select dataset: "movies"
3. Enter destination: "/media/movies"
4. Click "Index" button
5. Wait for toast notification
6. Navigate to /duplicates
7. Click "Rescan" button
8. Review results

Maintenance Commands

# Re-index weekly
watch-finished-cli index:destination --dataset movies --destination /media/movies --reindex

# Check stats
watch-finished-cli index:stats --dataset movies

# Clear old index
watch-finished-cli index:clear --dataset movies

Keyboard Shortcuts (Web UI)

  • Navigate to pages via menu
  • Use tab to navigate form fields
  • Enter to submit forms
  • Click buttons or use Space when focused

API Endpoints (for scripting)

# Index destination
POST /maintenance/index/destination
{
  "dataset": "movies",
  "destination": "/media/movies",
  "reindex": false,
  "batchSize": 100
}

# Get stats
GET /maintenance/index/stats?dataset=movies

# Get count
GET /maintenance/index/count?dataset=movies

# Clear index
DELETE /maintenance/index/movies

# Scan duplicates
POST /maintenance/duplicates/scan
{"resetExisting": false}

# List duplicates
GET /maintenance/duplicates?dataset=movies&status=pending

Environment Variables

# CLI
export WATCH_FINISHED_API="http://localhost:3000"

# Web UI
NEXT_PUBLIC_WATCH_FINISHED_API="http://localhost:3000"

Troubleshooting One-Liners

# Check if service is running
curl http://localhost:3000/health

# Test index count
curl "http://localhost:3000/maintenance/index/count?dataset=movies"

# Test index stats
curl "http://localhost:3000/maintenance/index/stats"

# Force re-index via API
curl -X POST http://localhost:3000/maintenance/index/destination \
  -H "Content-Type: application/json" \
  -d '{"dataset":"movies","destination":"/media/movies","reindex":true}'

Performance Tips

  • Batch Size: 50-200 depending on file size
  • Re-index: Only when significant changes occur
  • Scan: Use database mode (automatic after indexing)
  • Statistics: Query sparingly, cache results

Status Indicators

CLI

  • 🔍 Scanning
  • ✅ Success
  • 🗑️ Cleared
  • 📁 Indexing
  • 📊 Stats
  • 📈 Count

Web UI

  • Blue button = Index new files
  • Orange button = Re-index (rebuild)
  • Purple button = Navigate to indexing
  • Green button = Mark as not duplicate
  • Red button = Delete files

Quick Checks

# Is indexing needed?
if [ $(watch-finished-cli index:count --dataset movies | grep -o '[0-9]\+') -eq 0 ]; then
  echo "Indexing needed"
fi

# Are there duplicates?
if [ $(watch-finished-cli duplicates:list --dataset movies | wc -l) -gt 0 ]; then
  echo "Duplicates found"
fi