Documentation
¶
Index ¶
- func ApplyBoost(results []store.SearchResult, boostCfg config.BoostConfig) []store.SearchResult
- func FilterByGlob(results []store.SearchResult, globs []string) []store.SearchResult
- func FilterByType(results []store.SearchResult, types []string) []store.SearchResult
- func MergeSearchResultsRRF(resultSets [][]store.SearchResult, k float32, limit int) []store.SearchResult
- func ReciprocalRankFusion(k float32, limit int, lists ...[]store.SearchResult) []store.SearchResult
- func TextSearch(ctx context.Context, chunks []store.Chunk, query string, limit int) []store.SearchResult
- type FederatedResult
- type FederatedSearcher
- type Searcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyBoost ¶
func ApplyBoost(results []store.SearchResult, boostCfg config.BoostConfig) []store.SearchResult
ApplyBoost applies structural boosting to search results based on file path patterns. Penalties reduce scores (factor < 1), bonuses increase scores (factor > 1). Results are re-sorted by adjusted score after boosting.
func FilterByGlob ¶
func FilterByGlob(results []store.SearchResult, globs []string) []store.SearchResult
FilterByGlob filters results by glob patterns
func FilterByType ¶
func FilterByType(results []store.SearchResult, types []string) []store.SearchResult
FilterByType filters results by file extensions
func MergeSearchResultsRRF ¶
func MergeSearchResultsRRF(resultSets [][]store.SearchResult, k float32, limit int) []store.SearchResult
MergeSearchResultsRRF merges standard SearchResult slices using RRF. This is useful for combining results from different search methods within the same project.
func ReciprocalRankFusion ¶
func ReciprocalRankFusion(k float32, limit int, lists ...[]store.SearchResult) []store.SearchResult
ReciprocalRankFusion merges multiple result lists using RRF. k is the RRF constant (typically 60). Results are deduplicated by chunk ID and sorted by combined RRF score.
func TextSearch ¶
func TextSearch(ctx context.Context, chunks []store.Chunk, query string, limit int) []store.SearchResult
TextSearch performs a simple text-based search on chunks. It scores chunks based on the number of query words they contain.
Types ¶
type FederatedResult ¶
type FederatedResult struct {
store.SearchResult
ProjectName string `json:"project_name"`
ProjectPath string `json:"project_path"`
}
FederatedResult extends SearchResult with project information.
func MergeResultsRRF ¶
func MergeResultsRRF(resultSets [][]FederatedResult, k float32, limit int) []FederatedResult
MergeResultsRRF merges multiple result sets using Reciprocal Rank Fusion. RRF score = sum(1 / (k + rank)) where k is typically 60. Results are deduplicated by a unique key (project + file + start_line).
type FederatedSearcher ¶
type FederatedSearcher struct {
// contains filtered or unexported fields
}
FederatedSearcher searches across multiple projects and merges results.
func NewFederatedSearcher ¶
func NewFederatedSearcher(emb embedder.Embedder) *FederatedSearcher
NewFederatedSearcher creates a new federated searcher.
func (*FederatedSearcher) Search ¶
func (f *FederatedSearcher) Search(ctx context.Context, projectNames []string, query string, limit int) ([]FederatedResult, error)
Search searches across multiple projects and merges results using RRF. If projectNames is nil or empty, it searches all registered projects.
type Searcher ¶
type Searcher struct {
// contains filtered or unexported fields
}
func NewSearcher ¶
func NewSearcher(st store.VectorStore, emb embedder.Embedder, searchCfg config.SearchConfig) *Searcher