Files
claudia-docs-api/app/schemas/search.py
Motoko 07f9ac91fc Phase 3: Graph view, backlinks, quick switcher, export
- Add outgoing_links (JSON) and backlinks_count to Document model
- POST /documents/{id}/detect-links — detect [[uuid]] patterns in content
- GET /documents/{id}/backlinks — documents referencing this doc
- GET /documents/{id}/outgoing-links — documents this doc references
- GET /documents/{id}/links — combined incoming + outgoing
- GET /projects/{id}/graph — full project relationship graph
- GET /search/quick — fuzzy search (Quick Switcher Cmd+K)
- GET /projects/{id}/documents/search — project-scoped search
- GET /documents/{id}/export — markdown|json export
- GET /projects/{id}/export — json|zip export
- 27 new tests
2026-03-30 23:46:45 +00:00

55 lines
1.2 KiB
Python

from datetime import datetime
from pydantic import BaseModel
from app.schemas.document import TagInfo
class SearchResult(BaseModel):
id: str
title: str
excerpt: str
project_id: str
tags: list[TagInfo] = []
score: float
class SearchResponse(BaseModel):
results: list[SearchResult]
# =============================================================================
# Phase 3: Quick Switcher Schemas (Fuzzy Search)
# =============================================================================
class QuickSwitcherItem(BaseModel):
id: str
type: str # "document" | "project"
title: str
subtitle: str | None = None
highlight: str | None = None # HTML with <mark> tags
icon: str | None = None
project_id: str | None = None
class QuickSwitcherResponse(BaseModel):
query: str
results: list[QuickSwitcherItem]
total: int
search_type: str = "fuzzy"
class ProjectDocumentSearchItem(BaseModel):
document_id: str
title: str
excerpt: str
updated_at: datetime
score: float
class ProjectDocumentSearchResponse(BaseModel):
project_id: str
query: str
results: list[ProjectDocumentSearchItem]
total: int