scoring

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package scoring implements the SQLite scoring store for Cortex.

It provides importance scoring persistence operations including score retrieval, updates, access tracking, and batch operations. The store implements the scoring.Repository interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements the SQLite scoring store.

func NewStore

func NewStore(db *sql.DB) *Store

NewStore creates a new scoring store with the given database connection.

func (*Store) GetAllScores

func (s *Store) GetAllScores(ctx context.Context) ([]*domain.ImportanceScore, error)

GetAllScores retrieves all scores for batch operations like decay.

func (*Store) GetIncomingEdgeCount

func (s *Store) GetIncomingEdgeCount(ctx context.Context, obsID int64) (int, error)

GetIncomingEdgeCount returns the number of edges pointing to this observation.

func (*Store) GetObservation

func (s *Store) GetObservation(ctx context.Context, obsID int64) (*domain.Observation, error)

GetObservation retrieves observation data needed for score calculation.

func (*Store) GetScore

func (s *Store) GetScore(ctx context.Context, obsID int64) (*domain.ImportanceScore, error)

GetScore retrieves the importance score for an observation.

func (*Store) GetTop

func (s *Store) GetTop(ctx context.Context, project string, limit int) ([]*domain.ImportanceScore, error)

GetTop retrieves the most important observations for a project.

func (*Store) GetTopByScore

func (s *Store) GetTopByScore(ctx context.Context, project string, limit int) ([]*domain.ImportanceScore, error)

GetTopByScore retrieves the top-N highest scored observations for a project.

func (*Store) RecordAccess

func (s *Store) RecordAccess(ctx context.Context, obsID int64) error

RecordAccess increments the access count and updates last_accessed timestamp.

func (*Store) SetScore

func (s *Store) SetScore(ctx context.Context, obsID int64, score float64) error

SetScore updates the score value for an observation.

func (*Store) UpdateScore

func (s *Store) UpdateScore(ctx context.Context, obsID int64, increment float64) error

UpdateScore adjusts the importance score by the given increment, clamped to [0.0, 5.0].

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL