Documentation
¶
Overview ¶
@index retrieval 패키지의 순수 DB 후보 처리 헬퍼 함수 모음.
@index Search retrieval response DTOs, scoring service, and consumer-owned outbound ports.
Index ¶
- func DBCandidateLimit(limit int) int
- func DBPath(filePath string) []string
- func DBSummary(nodes []graph.Node, annotations map[uint]*graph.Annotation) string
- func IsRetrievableNodeKind(kind graph.NodeKind) bool
- func MatchedTerms(query string) []string
- func NodeMatchesTerms(node graph.Node, terms []string) bool
- func ScoreDBFields(nodes []graph.Node, annotations map[uint]*graph.Annotation, terms []string) (int, map[string]int, []string)
- func TextContainsAnyTerm(text string, terms []string) bool
- type CandidateSearcher
- type ContentReader
- type DBFileGroup
- type Repository
- type Response
- type Result
- type RetrieveResult
- type SearchResult
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DBCandidateLimit ¶
DBCandidateLimit은 그룹화 후 파일 단위 결과 수가 충분하도록 FTS 후보 수를 결정한다. @intent doc retrieval는 파일당 하나의 결과를 반환하므로 후보 수는 최종 파일 한도를 초과해야 하되 무한정 커지면 안 된다. @domainRule 후보 수는 최소 dbCandidateFloor, 최대 dbCandidateCap으로 제한한다.
func DBPath ¶
DBPath는 정규화된 파일 경로 세그먼트로부터 DB-backed 결과의 비어있지 않은 경로 조각을 생성한다. @intent 정규화된 파일 경로 세그먼트로부터 DB-backed 결과의 비어있지 않은 경로 조각을 생성한다.
func DBSummary ¶
DBSummary는 그룹화된 DB-backed 노드에서 첫 번째 사용 가능한 어노테이션 요약/태그 값을 선택한다. @intent 첫 번째 사용 가능한 어노테이션 요약 또는 태그 값을 간결한 파일 수준 DB-backed 요약으로 선택한다.
func IsRetrievableNodeKind ¶
@intent identify graph node kinds that can resolve to a generated file-level documentation result.
func MatchedTerms ¶
MatchedTerms는 쿼리 문자열을 소문자 토큰으로 분리하고 중복을 제거한다. @intent DB-backed 응답 증거를 위해 검색 쿼리를 결정론적 소문자 용어로 토큰화하고 코드 식별자 alias를 보강한다.
func NodeMatchesTerms ¶
NodeMatchesTerms는 노드 또는 어노테이션 텍스트가 검색 용어 중 하나라도 일치하는지 확인한다. @intent 저장된 노드 또는 어노테이션 텍스트가 검색 용어와 일치하는지 감지한다.
func ScoreDBFields ¶
func ScoreDBFields(nodes []graph.Node, annotations map[uint]*graph.Annotation, terms []string) (int, map[string]int, []string)
ScoreDBFields scores DB-backed retrieval evidence using PageIndex-style structured bucket weights. @intent rank high-signal annotation buckets above generic text fallback for DB-backed doc retrieval.
func TextContainsAnyTerm ¶
TextContainsAnyTerm은 텍스트가 주어진 용어 중 하나라도 포함하는지 대소문자 무시로 확인한다. @intent DB-backed 매칭 필드 진단을 위한 단순 대소문자 무시 용어 포함 검사를 수행한다.
Types ¶
type CandidateSearcher ¶
type CandidateSearcher interface {
Query(ctx context.Context, query string, limit int) ([]graph.Node, error)
}
CandidateSearcher returns relevance-ordered full-text candidates. @intent let retrieval consume a bound search implementation without a database handle.
type ContentReader ¶
type ContentReader func(ctx context.Context, namespace, docPath string, limit int) (string, bool, error)
@intent 문서 본문을 namespace/docPath 기준으로 읽고 필요시 잘라내기 여부를 반환한다.
type DBFileGroup ¶
DBFileGroup은 파일 경로별로 묶인 DB 후보 노드 그룹이다. @intent doc retrieval DB-backed 결과가 파일 단위 세분성을 유지하도록 후보를 그룹화한다.
func GroupCandidatesByFile ¶
func GroupCandidatesByFile(nodes []graph.Node, limit int) ([]DBFileGroup, []uint)
GroupCandidatesByFile은 관련성 순서의 심볼/파일 후보를 안정적인 파일 그룹으로 축소한다. @intent 관련성 순서의 심볼/파일 후보를 안정적인 파일 그룹으로 축소하면서 각 파일의 노드 증거를 유지한다.
type Repository ¶
type Repository interface {
ScanCandidates(ctx context.Context, kinds []graph.NodeKind, limit int) ([]graph.Node, error)
Annotations(ctx context.Context, nodeIDs []uint) (map[uint]*graph.Annotation, error)
}
Repository supplies bounded fallback candidates and structured annotations. @intent isolate namespace-scoped retrieval persistence from grouping, scoring, and ranking policy.
type Response ¶
type Response struct {
Results []Result `json:"results"`
}
@intent 검색 결과 배열을 JSON 응답으로 직렬화하는 공용 DTO를 제공한다.
type Result ¶
type Result struct {
RetrieveResult
Content string `json:"content,omitempty"`
ContentTruncated bool `json:"content_truncated,omitempty"`
}
Result adds optional document content to one scored retrieval candidate. @intent preserve the MCP and Wiki retrieval JSON contract while app/search owns the result.
type RetrieveResult ¶
type RetrieveResult struct {
ID string `json:"id"`
Label string `json:"label"`
Kind string `json:"kind"`
Summary string `json:"summary"`
DocPath string `json:"doc_path"`
Path []string `json:"path"`
Score int `json:"score"`
MatchedTerms []string `json:"matched_terms"`
MatchedFields []string `json:"matched_fields"`
Matches []SearchResult `json:"matches,omitempty"`
}
RetrieveResult is one scored file-level document candidate. @intent own search retrieval output independently from the legacy Wiki tree index.
func BuildDBResult ¶
func BuildDBResult(group DBFileGroup, annotations map[uint]*graph.Annotation, terms []string, index int) RetrieveResult
BuildDBResult는 그룹화된 DB 검색 히트와 구조화된 어노테이션으로부터 파일 수준 문서 후보를 도출한다. @intent score DB-backed doc candidates from structured annotation buckets while preserving backend rank in response order.
type SearchResult ¶
type SearchResult struct {
ID string `json:"id"`
Label string `json:"label"`
Kind string `json:"kind"`
Summary string `json:"summary"`
DocPath string `json:"doc_path,omitempty"`
Path []string `json:"path"`
}
SearchResult is compact node evidence nested under a file-level retrieval result. @intent preserve the existing JSON evidence shape without depending on Wiki tree DTO ownership.
func DBMatches ¶
func DBMatches(nodes []graph.Node, annotations map[uint]*graph.Annotation) []SearchResult
DBMatches는 그룹화된 DB-backed 노드에 대한 간결한 검색 스타일 증거 항목을 생성한다. @intent 그룹화된 DB-backed 노드에 대한 간결한 검색 스타일 증거 항목을 생성한다.
type Service ¶
type Service struct {
Search CandidateSearcher
Repository Repository
ContentReader ContentReader
}
Service coordinates full-text candidates, bounded persistence fallback, and content lookup. @intent provide one application entry point for document retrieval.
func New ¶
func New(search CandidateSearcher, repository Repository) *Service
New constructs a retrieval service from consumer-owned outbound ports. @intent make search and persistence dependencies explicit at composition time.
func (*Service) FromDB ¶
func (s *Service) FromDB(ctx context.Context, namespace, query string, limit, contentLimit int, read ContentReader) (Response, error)
FromDB builds a doc search/retrieval response from persisted graph nodes and annotations. @intent orchestrate DB-backed doc lookup through search backend first and namespace-scoped scan supplementation second. @requires Service.Repository must be configured and limit must be positive for meaningful results. @ensures results are grouped one-per-file, annotation-enriched, and optionally populated with bounded content. @sideEffect queries the configured database and may invoke an injected content reader.