Documentation
¶
Index ¶
- Constants
- func InferKeywords(text string) []string
- func MatchesKeywords(text string, keywords []string, match string) (int, bool)
- func NormalizeMatch(match string) string
- func SearchText(msg *Message) string
- type GormVectorStore
- type HybridConfig
- type HybridSearcher
- type HybridWeights
- type KeywordSearcher
- type KeywordStore
- type Message
- type MessageSource
- type SearchHit
- type SearchMode
- type SearchQuery
- type Searcher
- type VectorSearcher
- type VectorStore
Constants ¶
View Source
const ( MatchAny = "any" MatchAll = "all" )
View Source
const ( HybridStrategyRRF = "rrf" HybridStrategyWeighted = "weighted" )
Variables ¶
This section is empty.
Functions ¶
func InferKeywords ¶
func MatchesKeywords ¶
func NormalizeMatch ¶
func SearchText ¶
Types ¶
type GormVectorStore ¶
type GormVectorStore struct {
// contains filtered or unexported fields
}
func NewGormVectorStore ¶
func NewGormVectorStore(db *gorm.DB, tableName string) (*GormVectorStore, error)
func (*GormVectorStore) Search ¶
func (s *GormVectorStore) Search(ctx context.Context, q *SearchQuery, vector []float64, limit int) ([]*SearchHit, error)
type HybridConfig ¶
type HybridConfig struct {
Strategy string
RRFK int
Weights HybridWeights
}
type HybridSearcher ¶
type HybridSearcher struct {
// contains filtered or unexported fields
}
func NewHybridSearcher ¶
func NewHybridSearcher(keyword Searcher, vector Searcher, cfg HybridConfig) *HybridSearcher
func (*HybridSearcher) Index ¶
func (s *HybridSearcher) Index(ctx context.Context, msg *Message) error
func (*HybridSearcher) Reindex ¶
func (s *HybridSearcher) Reindex(ctx context.Context, sessionID, userID string) error
func (*HybridSearcher) Search ¶
func (s *HybridSearcher) Search(ctx context.Context, q *SearchQuery) ([]*SearchHit, error)
type HybridWeights ¶
type KeywordSearcher ¶
type KeywordSearcher struct {
// contains filtered or unexported fields
}
func NewKeywordSearcher ¶
func NewKeywordSearcher(store KeywordStore) *KeywordSearcher
func (*KeywordSearcher) Search ¶
func (s *KeywordSearcher) Search(ctx context.Context, q *SearchQuery) ([]*SearchHit, error)
type KeywordStore ¶
type KeywordStore interface {
MessageSource
SearchMessagesByKeywords(ctx context.Context, q *SearchQuery) ([]*Message, error)
}
type Message ¶
type Message struct {
ID string
SessionID string
UserID string
Role string
Content string
Parts []schema.MessageInputPart
CreatedAt time.Time
}
func CloneMessage ¶
type MessageSource ¶
type SearchMode ¶
type SearchMode string
const ( ModeKeyword SearchMode = "keyword" ModeVector SearchMode = "vector" ModeHybrid SearchMode = "hybrid" )
type SearchQuery ¶
type VectorSearcher ¶
type VectorSearcher struct {
// contains filtered or unexported fields
}
func NewVectorSearcher ¶
func NewVectorSearcher(embedder embedding.Embedder, store VectorStore, source MessageSource) (*VectorSearcher, error)
func (*VectorSearcher) Index ¶
func (s *VectorSearcher) Index(ctx context.Context, msg *Message) error
func (*VectorSearcher) Reindex ¶
func (s *VectorSearcher) Reindex(ctx context.Context, sessionID, userID string) error
func (*VectorSearcher) Search ¶
func (s *VectorSearcher) Search(ctx context.Context, q *SearchQuery) ([]*SearchHit, error)
Click to show internal directories.
Click to hide internal directories.