Documentation
¶
Overview ¶
@index ragindex 패키지는 DB의 커뮤니티/어노테이션 데이터를 읽어 doc-index.json을 빌드한다.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
DB *gorm.DB
OutDir string // docs 디렉토리 (기본: "docs")
IndexDir string // .ccg 디렉토리 (기본: ".ccg")
ProjectDesc string // root 노드 summary (기본: "")
}
Builder는 DB에서 인덱스를 빌드하는 구조체이다. @intent 그래프 DB와 문서 출력 경로를 연결해 doc-index.json 생성을 조율한다.
type Index ¶
type Index struct {
Version int `json:"version"`
BuiltAt time.Time `json:"built_at"`
Root *TreeNode `json:"root"`
}
Index는 .ccg/doc-index.json 전체 포맷이다. @intent 디스크에 저장되는 문서 인덱스 루트 페이로드를 정의한다.
type RetrieveResult ¶
type RetrieveResult struct {
ID string `json:"id"`
Label string `json:"label"`
Summary string `json:"summary"`
DocPath string `json:"doc_path"`
Path []string `json:"path"`
Score int `json:"score"`
MatchedTerms []string `json:"matched_terms"`
Matches []SearchResult `json:"matches,omitempty"`
}
RetrieveResult represents one document candidate selected from tree-aware query matching. @intent return file-level RAG retrieval candidates with the matched tree evidence that caused the hit.
func Retrieve ¶
func Retrieve(root *TreeNode, query string, maxResults int) []RetrieveResult
Retrieve scores file nodes by matching query terms against the file node and its symbol descendants. @intent support PageIndex-style document retrieval where multiple query terms can be satisfied across one subtree. @requires query must contain at least one searchable term.
type SearchResult ¶
type SearchResult struct {
ID string `json:"id"`
Label string `json:"label"`
Summary string `json:"summary"`
DocPath string `json:"doc_path,omitempty"`
Path []string `json:"path"` // root부터 해당 노드까지의 Label 경로
}
SearchResult는 Search 함수가 반환하는 단일 매칭 결과이다. @intent 검색 UI나 MCP 응답에서 표시할 최소 결과 정보를 담는다.
type TreeNode ¶
type TreeNode struct {
ID string `json:"id"`
Label string `json:"label"`
Summary string `json:"summary"`
DocPath string `json:"doc_path,omitempty"` // file 노드만 설정
Children []*TreeNode `json:"children"`
}
TreeNode는 doc-index.json의 단일 노드이다. @intent RAG 탐색 트리에서 커뮤니티, 파일, 심볼 노드를 동일 구조로 표현한다.