package models import ( "github.com/bluesky-social/indigo/atproto/syntax" "github.com/sourcegraph/zoekt" ) // Result is union type of file/chunk match type Result struct { RepoDID syntax.DID File *Result_FileMatch Chunk *Result_ChunkMatch } type Result_FileMatch struct { FilePath string Branches []string // branch names Commit string // commit id Language string // Ranges are the matched span(s) within FilePath. LineNumber is always 1 for // filename matches; Column is 1-based and in runes. Ranges []zoekt.Range } type Result_ChunkMatch struct { FilePath string Branches []string // branch names Commit string // commit id Language string // Content is a contiguous run of complete lines that fully contains Ranges. Content string // ContentStartLine is the 1-based line number of Content's first line. ContentStartLine int // Ranges are the matched span(s) within the file. LineNumber/Column are // 1-based, Column is in runes. A Range may span multiple lines. Ranges []zoekt.Range } // IsFileMatch tells if search result is from file-name match func (r *Result) IsFileMatch() bool { return r.File != nil } // IsChunkMatch tells if search result is from chunk match func (r *Result) IsChunkMatch() bool { return r.Chunk != nil }