Documentation
¶
Overview ¶
Package service provides application layer services that orchestrate domain operations.
Index ¶
- Variables
- type Blob
- func (b *Blob) Content(ctx context.Context, repoID int64, blobName, filePath string) (BlobContent, error)
- func (b *Blob) DiskPath(ctx context.Context, repoID int64, blobName, filePath string) (string, string, error)
- func (b *Blob) ListFiles(ctx context.Context, repoID int64, pattern string) ([]FileEntry, error)
- func (b *Blob) ListFilesForCommit(ctx context.Context, repoID int64, commitSHA, pattern string) ([]FileEntry, error)
- func (b *Blob) Resolve(ctx context.Context, repoID int64, blobName string) (string, error)
- type BlobContent
- type ChunkingConfigParams
- type Commit
- type CommitOperationResolver
- type CreatePipelineParams
- type Enrichment
- func (s *Enrichment) Count(ctx context.Context, params *EnrichmentListParams) (int64, error)
- func (s *Enrichment) DeleteBy(ctx context.Context, opts ...repository.Option) error
- func (s *Enrichment) List(ctx context.Context, params *EnrichmentListParams) ([]enrichment.Enrichment, error)
- func (s *Enrichment) RelatedEnrichments(ctx context.Context, enrichmentIDs []int64) (map[string][]enrichment.Enrichment, error)
- func (s *Enrichment) ReleaseForRepository(ctx context.Context, enrichmentIDs []int64, repoID int64) ([]int64, error)
- func (s *Enrichment) RepositoryEnrichmentIDs(ctx context.Context, repoID int64) ([]int64, error)
- func (s *Enrichment) RepositoryIDs(ctx context.Context, enrichmentIDs []int64) (map[string][]int64, error)
- func (s *Enrichment) Save(ctx context.Context, e enrichment.Enrichment) (enrichment.Enrichment, error)
- func (s *Enrichment) SourceFiles(ctx context.Context, enrichmentIDs []int64) (map[string][]int64, error)
- func (s *Enrichment) SourceLocations(ctx context.Context, enrichmentIDs []int64) (map[string]sourcelocation.SourceLocation, error)
- type EnrichmentListParams
- type File
- type FileEntry
- type Grep
- type GrepResult
- type Handler
- type LineFilter
- type MultiSearchResult
- type PeriodicSync
- type Pipeline
- func (s *Pipeline) CountSteps(ctx context.Context, options ...repository.Option) (int64, error)
- func (s *Pipeline) Create(ctx context.Context, params *CreatePipelineParams) (PipelineDetail, error)
- func (s *Pipeline) DefaultID(ctx context.Context) (int64, error)
- func (s *Pipeline) Delete(ctx context.Context, id int64) error
- func (s *Pipeline) Detail(ctx context.Context, id int64) (PipelineDetail, error)
- func (s *Pipeline) DetailStep(ctx context.Context, stepID int64) (StepDetail, error)
- func (s *Pipeline) FindStep(ctx context.Context, id int64) (repository.Step, error)
- func (s *Pipeline) FindSteps(ctx context.Context, options ...repository.Option) ([]repository.Step, error)
- func (s *Pipeline) Initialise(ctx context.Context) error
- func (s *Pipeline) Operations(ctx context.Context, pipelineID int64) ([]task.Operation, error)
- func (s *Pipeline) RequiredOperations() []task.Operation
- func (s *Pipeline) Update(ctx context.Context, id int64, params *UpdatePipelineParams) (PipelineDetail, error)
- type PipelineDetail
- type Queue
- func (s *Queue) Count(ctx context.Context) (int64, error)
- func (s *Queue) DrainForRepository(ctx context.Context, repoID int64) (int, error)
- func (s *Queue) Enqueue(ctx context.Context, t task.Task) error
- func (s *Queue) EnqueueOperations(ctx context.Context, operations []task.Operation, basePriority task.Priority, ...) error
- func (s *Queue) Get(ctx context.Context, id int64) (task.Task, error)
- func (s *Queue) List(ctx context.Context, params *TaskListParams) ([]task.Task, error)
- func (s *Queue) Remove(ctx context.Context, id int64) error
- func (s *Queue) Reprioritize(ctx context.Context, id int64, priority int) error
- type Registry
- type Repository
- func (s *Repository) Add(ctx context.Context, params *RepositoryAddParams) (repository.Source, bool, error)
- func (s *Repository) AssignPipeline(ctx context.Context, repoID, pipelineID int64) (repository.Source, error)
- func (s *Repository) BackfillDefaultPipeline(ctx context.Context) error
- func (s *Repository) BranchesForRepository(ctx context.Context, repoID int64) ([]repository.Branch, error)
- func (s *Repository) Delete(ctx context.Context, id int64) error
- func (s *Repository) Rescan(ctx context.Context, params *RescanParams) error
- func (s *Repository) RescanAll(ctx context.Context) error
- func (s *Repository) SummaryByID(ctx context.Context, id int64) (repository.RepositorySummary, error)
- func (s *Repository) Sync(ctx context.Context, id int64) error
- func (s *Repository) UpdateChunkingConfig(ctx context.Context, id int64, params *ChunkingConfigParams) (repository.Repository, error)
- func (s *Repository) UpdateTrackingConfig(ctx context.Context, id int64, params *TrackingConfigParams) (repository.Source, error)
- type RepositoryAddParams
- type RescanParams
- type Search
- func (s Search) Available() bool
- func (s Search) Query(ctx context.Context, query string, opts ...SearchOption) (SearchResult, error)
- func (s Search) Search(ctx context.Context, request search.MultiRequest) (MultiSearchResult, error)
- func (s Search) SearchCode(ctx context.Context, query string, topK int) ([]enrichment.Enrichment, error)
- func (s Search) SearchCodeWithScores(ctx context.Context, query string, topK int, filters search.Filters) ([]enrichment.Enrichment, map[string]float64, error)
- func (s Search) SearchKeywordsWithScores(ctx context.Context, query string, limit int, filters search.Filters) ([]enrichment.Enrichment, map[string]float64, error)
- func (s Search) SearchText(ctx context.Context, query string, topK int) ([]enrichment.Enrichment, error)
- func (s Search) SearchVisualWithScores(ctx context.Context, query string, topK int, filters search.Filters) ([]enrichment.Enrichment, map[string]float64, error)
- type SearchOption
- func WithDocuments(include bool) SearchOption
- func WithEnrichmentTypes(types ...string) SearchOption
- func WithLanguages(langs ...string) SearchOption
- func WithLimit(n int) SearchOption
- func WithMinScore(score float64) SearchOption
- func WithOffset(n int) SearchOption
- func WithRepositories(ids ...int64) SearchOption
- func WithSemanticWeight(w float64) SearchOption
- func WithSnippets(include bool) SearchOption
- type SearchResult
- type StepDetail
- type StepParams
- type Tag
- type TaskListParams
- type Tracking
- type TrackingConfigParams
- type UpdatePipelineParams
- type Worker
- type WorkerTracker
- type WorkerTrackerFactory
Constants ¶
This section is empty.
Variables ¶
var ErrClientClosed = errors.New("kodit: client is closed")
ErrClientClosed indicates the client has been closed.
Functions ¶
This section is empty.
Types ¶
type Blob ¶
type Blob struct {
// contains filtered or unexported fields
}
Blob resolves blob references (commit SHA, tag, branch) and retrieves file content.
func NewBlob ¶
func NewBlob( repositories repository.RepositoryStore, commits repository.CommitStore, tags repository.TagStore, branches repository.BranchStore, gitAdapter git.Adapter, ) *Blob
NewBlob creates a new Blob service.
func (*Blob) Content ¶
func (b *Blob) Content(ctx context.Context, repoID int64, blobName, filePath string) (BlobContent, error)
Content resolves the blob reference and returns the file content at the given path.
func (*Blob) DiskPath ¶ added in v1.3.0
func (b *Blob) DiskPath(ctx context.Context, repoID int64, blobName, filePath string) (string, string, error)
DiskPath resolves the blob reference and returns the absolute file path on disk.
func (*Blob) ListFiles ¶
ListFiles walks the repository working copy on disk and returns files matching the pattern.
type BlobContent ¶
type BlobContent struct {
// contains filtered or unexported fields
}
BlobContent holds the resolved content and metadata for a file at a given blob reference.
func NewBlobContent ¶
func NewBlobContent(content []byte, commitSHA string) BlobContent
NewBlobContent creates a BlobContent from raw bytes and a commit SHA.
func (BlobContent) CommitSHA ¶
func (b BlobContent) CommitSHA() string
CommitSHA returns the resolved commit SHA.
func (BlobContent) Content ¶
func (b BlobContent) Content() []byte
Content returns the raw file bytes.
type ChunkingConfigParams ¶ added in v1.2.1
ChunkingConfigParams holds the parameters for updating a repository's chunking config.
type Commit ¶
type Commit struct {
repository.Collection[repository.Commit]
}
Commit provides read access to commits, extensible with bespoke methods later.
func NewCommit ¶
func NewCommit(store repository.CommitStore) *Commit
NewCommit creates a new Commit service wrapping the given store.
type CommitOperationResolver ¶ added in v1.2.4
type CommitOperationResolver interface {
DefaultID(ctx context.Context) (int64, error)
Operations(ctx context.Context, pipelineID int64) ([]task.Operation, error)
}
CommitOperationResolver resolves the operation sequence for a pipeline.
type CreatePipelineParams ¶ added in v1.2.4
type CreatePipelineParams struct {
Name string
Steps []StepParams
}
CreatePipelineParams holds the parameters for creating a new pipeline.
type Enrichment ¶
type Enrichment struct {
repository.Collection[enrichment.Enrichment]
// contains filtered or unexported fields
}
Enrichment provides queries for enrichments and their associations. Embeds Collection for Find/Get/Count; bespoke methods handle complex queries.
func NewEnrichment ¶
func NewEnrichment( enrichmentStore enrichment.EnrichmentStore, associationStore enrichment.AssociationStore, bm25Store search.Store, codeEmbeddingStore search.Store, textEmbeddingStore search.Store, visionEmbeddingStore search.Store, lineRangeStore sourcelocation.Store, ) *Enrichment
NewEnrichment creates a new Enrichment service.
func (*Enrichment) Count ¶
func (s *Enrichment) Count(ctx context.Context, params *EnrichmentListParams) (int64, error)
Count returns the total count of enrichments matching the given params (without pagination).
func (*Enrichment) DeleteBy ¶
func (s *Enrichment) DeleteBy(ctx context.Context, opts ...repository.Option) error
DeleteBy removes enrichments matching the given options. Also cleans up associated search indexes (BM25, code embeddings, text embeddings). Associations cascade-delete via the GORM OnDelete:CASCADE constraint on EnrichmentAssociationModel.
func (*Enrichment) List ¶
func (s *Enrichment) List(ctx context.Context, params *EnrichmentListParams) ([]enrichment.Enrichment, error)
List returns enrichments matching the given params. Commit SHA filtering is handled via enrichment.WithCommitSHA / WithCommitSHAs options, which the store resolves to association JOINs transparently.
func (*Enrichment) RelatedEnrichments ¶
func (s *Enrichment) RelatedEnrichments(ctx context.Context, enrichmentIDs []int64) (map[string][]enrichment.Enrichment, error)
RelatedEnrichments returns enrichments that reference the given enrichment IDs through the association store (e.g., snippet_summary enrichments pointing to snippet enrichments). Returns a map of parent enrichment ID (as string) to its related enrichments.
func (*Enrichment) ReleaseForRepository ¶ added in v1.4.0
func (s *Enrichment) ReleaseForRepository(ctx context.Context, enrichmentIDs []int64, repoID int64) ([]int64, error)
ReleaseForRepository removes repoID's claim on the given enrichments and returns the IDs it deleted. An enrichment that another repository also owns through its own repository association keeps existing and loses only repoID's association; every other enrichment is deleted with DeleteBy.
func (*Enrichment) RepositoryEnrichmentIDs ¶ added in v1.4.0
RepositoryEnrichmentIDs returns the IDs of the enrichments directly associated with repoID.
func (*Enrichment) RepositoryIDs ¶
func (s *Enrichment) RepositoryIDs(ctx context.Context, enrichmentIDs []int64) (map[string][]int64, error)
RepositoryIDs returns, keyed by enrichment ID, the repositories each enrichment belongs to, in ascending order. Membership comes only from the enrichment's direct repository associations, which indexing writes for the repository that produced the enrichment and for each repository that shares the commit. The search stores apply the same rule when filtering by source repository (infrastructure/persistence/search_filter_options.go).
func (*Enrichment) Save ¶
func (s *Enrichment) Save(ctx context.Context, e enrichment.Enrichment) (enrichment.Enrichment, error)
Save persists an enrichment (create or update). Associations cascade-delete via GORM constraints when an enrichment is removed.
func (*Enrichment) SourceFiles ¶
func (s *Enrichment) SourceFiles(ctx context.Context, enrichmentIDs []int64) (map[string][]int64, error)
SourceFiles returns file IDs grouped by enrichment ID string. It queries associations where enrichment_id IN (ids) and entity_type = "git_commit_files".
func (*Enrichment) SourceLocations ¶ added in v1.3.0
func (s *Enrichment) SourceLocations(ctx context.Context, enrichmentIDs []int64) (map[string]sourcelocation.SourceLocation, error)
SourceLocations returns source locations keyed by enrichment ID string.
type EnrichmentListParams ¶
type EnrichmentListParams struct {
Type *enrichment.Type
Subtype *enrichment.Subtype
CommitSHA string
CommitSHAs []string
Limit int
Offset int
}
EnrichmentListParams configures enrichment listing.
type File ¶
type File struct {
repository.Collection[repository.File]
}
File provides read access to files, extensible with bespoke methods later.
func NewFile ¶
func NewFile(store repository.FileStore) *File
NewFile creates a new File service wrapping the given store.
type Grep ¶
type Grep struct {
// contains filtered or unexported fields
}
Grep searches repository file contents using git grep.
func NewGrep ¶
func NewGrep( repositories repository.RepositoryStore, commits repository.CommitStore, gitAdapter git.Adapter, ) *Grep
NewGrep creates a new Grep service.
type GrepResult ¶
type GrepResult struct {
Path string
Language string
Matches []git.GrepMatch
CommitSHA string
RepoID int64
}
GrepResult holds grouped grep matches for a single file.
type LineFilter ¶
type LineFilter struct {
// contains filtered or unexported fields
}
LineFilter extracts specific line ranges from file content. Supports formats like "L17-L26,L45,L55-L90".
func NewLineFilter ¶
func NewLineFilter(param string) (LineFilter, error)
NewLineFilter parses a line filter parameter. An empty param returns a pass-through filter.
func (LineFilter) Apply ¶
func (f LineFilter) Apply(content []byte) []byte
Apply extracts matching lines from content. If no ranges are set (pass-through), returns the original content. Non-contiguous ranges are separated by an ellipsis line.
func (LineFilter) ApplyWithLineNumbers ¶
func (f LineFilter) ApplyWithLineNumbers(content []byte) []byte
ApplyWithLineNumbers extracts matching lines and prefixes each with its original 1-based line number and a tab character. If no ranges are set (pass-through), all lines are numbered. Non-contiguous ranges are separated by an ellipsis line.
func (LineFilter) Empty ¶
func (f LineFilter) Empty() bool
Empty returns true if this is a pass-through filter.
type MultiSearchResult ¶
type MultiSearchResult struct {
// contains filtered or unexported fields
}
MultiSearchResult represents the result of a multi-modal search.
func NewMultiSearchResult ¶
func NewMultiSearchResult( enrichments []enrichment.Enrichment, fusedScores map[string]float64, originalScores map[string][]float64, ) MultiSearchResult
NewMultiSearchResult creates a new MultiSearchResult.
func (MultiSearchResult) Count ¶
func (r MultiSearchResult) Count() int
Count returns the number of enrichments in the result.
func (MultiSearchResult) Enrichments ¶
func (r MultiSearchResult) Enrichments() []enrichment.Enrichment
Enrichments returns the matched enrichments.
func (MultiSearchResult) FusedScores ¶
func (r MultiSearchResult) FusedScores() map[string]float64
FusedScores returns a map of enrichment ID string to fused score.
func (MultiSearchResult) OriginalScores ¶
func (r MultiSearchResult) OriginalScores() map[string][]float64
OriginalScores returns a map of enrichment ID string to raw scores from each search method.
type PeriodicSync ¶
type PeriodicSync struct {
// contains filtered or unexported fields
}
PeriodicSync enqueues SyncRepository tasks for all repositories on a timer.
func NewPeriodicSync ¶
func NewPeriodicSync( cfg config.PeriodicSyncConfig, repositories repository.RepositoryStore, queue *Queue, logger zerolog.Logger, ) *PeriodicSync
NewPeriodicSync creates a new PeriodicSync from config and dependencies.
func (*PeriodicSync) Start ¶
func (p *PeriodicSync) Start(ctx context.Context)
Start begins periodic sync in a background goroutine. If disabled, this is a no-op.
func (*PeriodicSync) Stop ¶
func (p *PeriodicSync) Stop()
Stop cancels the background goroutine and waits for it to finish.
type Pipeline ¶ added in v1.2.4
type Pipeline struct {
repository.Collection[repository.Pipeline]
// contains filtered or unexported fields
}
Pipeline provides CRUD operations for pipelines and their steps.
func NewPipeline ¶ added in v1.2.4
func NewPipeline( pipelineStore repository.PipelineStore, stepStore repository.StepStore, pipelineStepStore repository.PipelineStepStore, dependencyStore repository.StepDependencyStore, prescribedOps task.PrescribedOperations, ) *Pipeline
NewPipeline creates a new Pipeline service.
func (*Pipeline) CountSteps ¶ added in v1.2.4
CountSteps delegates to the step store for counting steps.
func (*Pipeline) Create ¶ added in v1.2.4
func (s *Pipeline) Create(ctx context.Context, params *CreatePipelineParams) (PipelineDetail, error)
Create validates and persists a new pipeline with its steps and dependencies.
func (*Pipeline) DefaultID ¶ added in v1.2.4
DefaultID returns the ID of the first pipeline ordered by ID.
func (*Pipeline) Delete ¶ added in v1.2.4
Delete removes a pipeline and all associated steps and dependencies.
func (*Pipeline) Detail ¶ added in v1.2.4
Detail returns a pipeline with all its steps and dependencies.
func (*Pipeline) DetailStep ¶ added in v1.2.4
DetailStep loads a step with its dependencies.
func (*Pipeline) FindSteps ¶ added in v1.2.4
func (s *Pipeline) FindSteps(ctx context.Context, options ...repository.Option) ([]repository.Step, error)
FindSteps delegates to the step store for top-level step queries.
func (*Pipeline) Initialise ¶ added in v1.2.4
Initialise seeds built-in pipelines on first run and reconciles them on every startup so that new operations are added automatically.
func (*Pipeline) Operations ¶ added in v1.2.4
Operations loads the pipeline, topologically sorts its steps, and returns their Kind values as task.Operation.
func (*Pipeline) RequiredOperations ¶ added in v1.2.4
RequiredOperations returns all operations that handlers must support.
func (*Pipeline) Update ¶ added in v1.2.4
func (s *Pipeline) Update(ctx context.Context, id int64, params *UpdatePipelineParams) (PipelineDetail, error)
Update replaces all steps and dependencies for an existing pipeline.
type PipelineDetail ¶ added in v1.2.4
type PipelineDetail struct {
// contains filtered or unexported fields
}
PipelineDetail is an immutable read-only view combining a pipeline with its steps and dependency graph.
func (PipelineDetail) Associations ¶ added in v1.2.4
func (d PipelineDetail) Associations() []repository.PipelineStep
Associations returns the pipeline-step associations (including join type).
func (PipelineDetail) Dependencies ¶ added in v1.2.4
func (d PipelineDetail) Dependencies() []repository.StepDependency
Dependencies returns the step dependencies for this pipeline.
func (PipelineDetail) Pipeline ¶ added in v1.2.4
func (d PipelineDetail) Pipeline() repository.Pipeline
Pipeline returns the pipeline entity.
func (PipelineDetail) Steps ¶ added in v1.2.4
func (d PipelineDetail) Steps() []repository.Step
Steps returns the steps belonging to this pipeline.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue provides the main interface for enqueuing and managing tasks.
func (*Queue) DrainForRepository ¶
DrainForRepository removes all pending tasks whose payload contains the given repository_id. This prevents stale enrichment/indexing tasks from blocking a repository deletion.
func (*Queue) Enqueue ¶
Enqueue adds a task to the queue. If a task with the same dedup_key exists, it updates the priority instead.
func (*Queue) EnqueueOperations ¶
func (s *Queue) EnqueueOperations( ctx context.Context, operations []task.Operation, basePriority task.Priority, payload map[string]any, ) error
EnqueueOperations queues multiple operations with decreasing priority. The first operation in the list has the highest priority, ensuring operations are processed in order.
func (*Queue) List ¶
List returns tasks matching the given params. Tasks are sorted by priority (highest first) then by created_at (oldest first).
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages task handlers for different operations.
func (*Registry) HasHandler ¶
HasHandler reports whether a handler is registered for the operation.
func (*Registry) Operations ¶
Operations returns all registered operations.
type Repository ¶
type Repository struct {
repository.Collection[repository.Repository]
// contains filtered or unexported fields
}
Repository provides repository management and query operations. Embeds Collection for Find/Get; bespoke methods handle writes and lifecycle.
func NewRepository ¶
func NewRepository( repoStore repository.RepositoryStore, pipelineStore repository.PipelineStore, commitStore repository.CommitStore, branchStore repository.BranchStore, tagStore repository.TagStore, queue *Queue, resolver CommitOperationResolver, logger zerolog.Logger, ) *Repository
NewRepository creates a new Repository service.
func (*Repository) Add ¶
func (s *Repository) Add(ctx context.Context, params *RepositoryAddParams) (repository.Source, bool, error)
Add creates a new repository and queues it for indexing. Returns the source, whether it was newly created, and any error. If the repository already exists, it returns the existing one with created=false.
func (*Repository) AssignPipeline ¶ added in v1.2.4
func (s *Repository) AssignPipeline(ctx context.Context, repoID, pipelineID int64) (repository.Source, error)
AssignPipeline links a pipeline to a repository.
func (*Repository) BackfillDefaultPipeline ¶ added in v1.2.4
func (s *Repository) BackfillDefaultPipeline(ctx context.Context) error
BackfillDefaultPipeline assigns the default pipeline to any repositories that have no pipeline assigned (pipelineID == 0).
func (*Repository) BranchesForRepository ¶
func (s *Repository) BranchesForRepository(ctx context.Context, repoID int64) ([]repository.Branch, error)
BranchesForRepository returns all branches for a repository.
func (*Repository) Delete ¶
func (s *Repository) Delete(ctx context.Context, id int64) error
Delete removes a repository and all associated data.
func (*Repository) Rescan ¶
func (s *Repository) Rescan(ctx context.Context, params *RescanParams) error
Rescan triggers a rescan of a specific commit.
func (*Repository) SummaryByID ¶
func (s *Repository) SummaryByID(ctx context.Context, id int64) (repository.RepositorySummary, error)
SummaryByID returns a detailed summary for a repository.
func (*Repository) Sync ¶
func (s *Repository) Sync(ctx context.Context, id int64) error
Sync triggers a sync (git fetch + branch scan + commit indexing) for a repository.
func (*Repository) UpdateChunkingConfig ¶ added in v1.2.1
func (s *Repository) UpdateChunkingConfig(ctx context.Context, id int64, params *ChunkingConfigParams) (repository.Repository, error)
UpdateChunkingConfig updates a repository's chunking configuration.
func (*Repository) UpdateTrackingConfig ¶
func (s *Repository) UpdateTrackingConfig(ctx context.Context, id int64, params *TrackingConfigParams) (repository.Source, error)
UpdateTrackingConfig updates a repository's tracking configuration.
type RepositoryAddParams ¶
type RepositoryAddParams struct {
URL string
UpstreamURL string
Pipeline string
Branch string
Tag string
Commit string
}
RepositoryAddParams configures adding a new repository.
type RescanParams ¶
RescanParams configures a commit rescan operation.
type Search ¶
type Search struct {
// contains filtered or unexported fields
}
Search orchestrates hybrid code search across text and code vector indexes.
func NewSearch ¶
func NewSearch( embedder search.Embedder, textVectorStore search.Store, codeVectorStore search.Store, bm25Store search.Store, visionEmbedder search.Embedder, visionVectorStore search.Store, enrichmentStore enrichment.EnrichmentStore, closed *atomic.Bool, logger zerolog.Logger, ) *Search
NewSearch creates a new Search service.
func (Search) Query ¶
func (s Search) Query(ctx context.Context, query string, opts ...SearchOption) (SearchResult, error)
Query performs a simple hybrid code search with options.
func (Search) Search ¶
func (s Search) Search(ctx context.Context, request search.MultiRequest) (MultiSearchResult, error)
Search performs a hybrid search combining text and code vector search results.
func (Search) SearchCode ¶
func (s Search) SearchCode(ctx context.Context, query string, topK int) ([]enrichment.Enrichment, error)
SearchCode performs code vector search against code snippet embeddings.
func (Search) SearchCodeWithScores ¶
func (s Search) SearchCodeWithScores(ctx context.Context, query string, topK int, filters search.Filters) ([]enrichment.Enrichment, map[string]float64, error)
SearchCodeWithScores performs code vector search and returns enrichments together with their similarity scores (keyed by enrichment ID string).
func (Search) SearchKeywordsWithScores ¶
func (s Search) SearchKeywordsWithScores(ctx context.Context, query string, limit int, filters search.Filters) ([]enrichment.Enrichment, map[string]float64, error)
SearchKeywordsWithScores performs BM25 keyword search and returns enrichments together with their BM25 scores (keyed by enrichment ID string).
func (Search) SearchText ¶
func (s Search) SearchText(ctx context.Context, query string, topK int) ([]enrichment.Enrichment, error)
SearchText performs text vector search against enrichment summaries.
func (Search) SearchVisualWithScores ¶ added in v1.3.0
func (s Search) SearchVisualWithScores(ctx context.Context, query string, topK int, filters search.Filters) ([]enrichment.Enrichment, map[string]float64, error)
SearchVisualWithScores performs cross-modal visual search: it embeds the text query using the vision model's text encoder and searches the vision embedding store, returning page-image enrichments with their similarity scores.
type SearchOption ¶
type SearchOption func(*searchConfig)
SearchOption configures a search request.
func WithDocuments ¶
func WithDocuments(include bool) SearchOption
WithDocuments includes enrichment documents in search results.
func WithEnrichmentTypes ¶
func WithEnrichmentTypes(types ...string) SearchOption
WithEnrichmentTypes includes specific enrichment types in results.
func WithLanguages ¶
func WithLanguages(langs ...string) SearchOption
WithLanguages filters results by programming languages.
func WithMinScore ¶
func WithMinScore(score float64) SearchOption
WithMinScore filters results below a minimum score threshold.
func WithRepositories ¶
func WithRepositories(ids ...int64) SearchOption
WithRepositories filters results by repository IDs.
func WithSemanticWeight ¶
func WithSemanticWeight(w float64) SearchOption
WithSemanticWeight sets the weight for semantic (vector) search (0-1).
func WithSnippets ¶
func WithSnippets(include bool) SearchOption
WithSnippets includes code snippets in search results.
type SearchResult ¶
type SearchResult struct {
// contains filtered or unexported fields
}
SearchResult represents the result of a hybrid search.
func (SearchResult) Count ¶
func (r SearchResult) Count() int
Count returns the number of enrichments in the result.
func (SearchResult) Enrichments ¶
func (r SearchResult) Enrichments() []enrichment.Enrichment
Enrichments returns the matched enrichments.
func (SearchResult) Scores ¶
func (r SearchResult) Scores() map[string]float64
Scores returns a map of enrichment ID string to fused search score.
type StepDetail ¶ added in v1.2.4
type StepDetail struct {
// contains filtered or unexported fields
}
StepDetail is an immutable read-only view of a step with its dependencies.
func (StepDetail) Dependencies ¶ added in v1.2.4
func (d StepDetail) Dependencies() []repository.StepDependency
Dependencies returns the step dependencies.
func (StepDetail) Step ¶ added in v1.2.4
func (d StepDetail) Step() repository.Step
Step returns the step entity.
type StepParams ¶ added in v1.2.4
StepParams describes a step to create within a pipeline.
type Tag ¶
type Tag struct {
repository.Collection[repository.Tag]
}
Tag provides read access to tags, extensible with bespoke methods later.
func NewTag ¶
func NewTag(store repository.TagStore) *Tag
NewTag creates a new Tag service wrapping the given store.
type TaskListParams ¶
TaskListParams configures task listing.
type Tracking ¶
type Tracking struct {
// contains filtered or unexported fields
}
Tracking provides read-only access to task status information.
func NewTracking ¶
func NewTracking( statusStore task.StatusStore, taskStore task.TaskStore, ) *Tracking
NewTracking creates a new Tracking service.
func (*Tracking) ActiveStatuses ¶ added in v1.1.4
ActiveStatuses returns all task statuses in started or in_progress state.
type TrackingConfigParams ¶
TrackingConfigParams configures a tracking config update.
type UpdatePipelineParams ¶ added in v1.2.4
type UpdatePipelineParams struct {
Name string
Steps []StepParams
}
UpdatePipelineParams holds the parameters for updating an existing pipeline.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker processes tasks from the queue.
func NewWorker ¶
func NewWorker(store task.TaskStore, statusStore task.StatusStore, registry *Registry, trackerFactory WorkerTrackerFactory, logger zerolog.Logger) *Worker
NewWorker creates a new queue worker.
func (*Worker) ProcessOne ¶
ProcessOne processes a single task synchronously (for testing).
func (*Worker) Start ¶
Start begins processing tasks from the queue. The worker runs in a goroutine and can be stopped with Stop().
type WorkerTracker ¶
type WorkerTracker interface {
Fail(ctx context.Context, message string)
Complete(ctx context.Context)
}
WorkerTracker marks a task status as failed or complete.
type WorkerTrackerFactory ¶
type WorkerTrackerFactory interface {
ForOperation(operation task.Operation, payload map[string]any) WorkerTracker
}
WorkerTrackerFactory creates trackers for task status updates.