Documentation
¶
Overview ¶
@index retrieval 패키지의 순수 DB 후보 처리 헬퍼 함수 모음.
@index retrieval 패키지는 RAG retrieval 응답 DTO와 서비스 의존성을 정의한다.
Index ¶
- func BuildDBResult(group DBFileGroup, annotations map[uint]*model.Annotation, terms []string, ...) ragindex.RetrieveResult
- func DBCandidateLimit(limit int) int
- func DBMatches(nodes []model.Node, annotations map[uint]*model.Annotation) []ragindex.SearchResult
- func DBPath(filePath string) []string
- func DBSummary(nodes []model.Node, annotations map[uint]*model.Annotation) string
- func IsRetrievableNodeKind(kind model.NodeKind) bool
- func MatchedTerms(query string) []string
- func NodeMatchesTerms(node model.Node, terms []string) bool
- func ScoreDBFields(nodes []model.Node, annotations map[uint]*model.Annotation, terms []string) (int, map[string]int, []string)
- func TextContainsAnyTerm(text string, terms []string) bool
- type ContentReader
- type DBFileGroup
- type Response
- type Result
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDBResult ¶
func BuildDBResult(group DBFileGroup, annotations map[uint]*model.Annotation, terms []string, index int) ragindex.RetrieveResult
BuildDBResult는 그룹화된 DB 검색 히트와 구조화된 어노테이션으로부터 파일 수준 문서 후보를 도출한다. @intent score DB-backed doc candidates from structured annotation buckets while preserving backend rank in response order.
func DBCandidateLimit ¶
DBCandidateLimit은 그룹화 후 파일 단위 결과 수가 충분하도록 FTS 후보 수를 결정한다. @intent doc retrieval는 파일당 하나의 결과를 반환하므로 후보 수는 최종 파일 한도를 초과해야 하되 무한정 커지면 안 된다. @domainRule 후보 수는 최소 dbCandidateFloor, 최대 dbCandidateCap으로 제한한다.
func DBMatches ¶
func DBMatches(nodes []model.Node, annotations map[uint]*model.Annotation) []ragindex.SearchResult
DBMatches는 그룹화된 DB-backed 노드에 대한 간결한 검색 스타일 증거 항목을 생성한다. @intent 그룹화된 DB-backed 노드에 대한 간결한 검색 스타일 증거 항목을 생성한다.
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 []model.Node, annotations map[uint]*model.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 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 []model.Node, limit int) ([]DBFileGroup, []uint)
GroupCandidatesByFile은 관련성 순서의 심볼/파일 후보를 안정적인 파일 그룹으로 축소한다. @intent 관련성 순서의 심볼/파일 후보를 안정적인 파일 그룹으로 축소하면서 각 파일의 노드 증거를 유지한다.
type Response ¶
type Response struct {
Results []Result `json:"results"`
}
@intent 검색 결과 배열을 JSON 응답으로 직렬화하는 공용 DTO를 제공한다.
type Result ¶
type Result struct {
ragindex.RetrieveResult
Content string `json:"content,omitempty"`
ContentTruncated bool `json:"content_truncated,omitempty"`
}
@intent RAG 후보 결과에 본문과 잘라내기 상태를 덧붙인 최종 응답 항목을 제공한다.
type Service ¶
type Service struct {
DB *gorm.DB
SearchBackend storesearch.Backend
ContentReader ContentReader
}
@intent DB와 검색 백엔드를 묶어 retrieval 로직의 공용 진입점을 제공한다.
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.DB 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.