Documentation
¶
Index ¶
- func SortHybridResults(results []HybridSearchResult)
- type DocumentData
- type EnhancedHybridStore
- func (hs *EnhancedHybridStore) Add(id string, vector []float32)
- func (hs *EnhancedHybridStore) AddDocument(id string, content string, metadata string, vector []float32) error
- func (hs *EnhancedHybridStore) Close() error
- func (hs *EnhancedHybridStore) GetContent(id string) string
- func (hs *EnhancedHybridStore) GetMetadata(id string) string
- func (hs *EnhancedHybridStore) HybridSearch(queryVector []float32, queryText string, limit int) ([]HybridSearchResult, error)
- func (hs *EnhancedHybridStore) Load(path string) error
- func (hs *EnhancedHybridStore) Remove(id string)
- func (hs *EnhancedHybridStore) Save(vectorPath string) error
- func (hs *EnhancedHybridStore) Search(query []float32, limit int) []SearchResult
- type HNSWStore
- type HybridSearchResult
- type SearchResult
- type Store
- type VectorItem
- type VectorStoreInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortHybridResults ¶
func SortHybridResults(results []HybridSearchResult)
SortHybridResults trie les résultats par score combiné décroissant
Types ¶
type DocumentData ¶
type DocumentData struct {
ID string `json:"id"`
Content string `json:"content"`
Metadata string `json:"metadata"`
}
DocumentData represents the data structure for Bleve indexing
type EnhancedHybridStore ¶
type EnhancedHybridStore struct {
VectorStore VectorStoreInterface `json:"-"`
TextIndex bleve.Index `json:"-"`
WeightBM25 float64 `json:"weight_bm25"`
// contains filtered or unexported fields
}
EnhancedHybridStore combines HNSW vector search and BM25 text search
func NewEnhancedHybridStore ¶
func NewEnhancedHybridStore(indexPath string, dimensions int) (*EnhancedHybridStore, error)
NewEnhancedHybridStore creates a new enhanced hybrid store
func (*EnhancedHybridStore) Add ¶
func (hs *EnhancedHybridStore) Add(id string, vector []float32)
Add implements the VectorStoreInterface
func (*EnhancedHybridStore) AddDocument ¶
func (hs *EnhancedHybridStore) AddDocument(id string, content string, metadata string, vector []float32) error
AddDocument adds a document to both the vector and text indexes
func (*EnhancedHybridStore) Close ¶
func (hs *EnhancedHybridStore) Close() error
Close properly closes the indexes
func (*EnhancedHybridStore) GetContent ¶
func (hs *EnhancedHybridStore) GetContent(id string) string
GetContent returns a document's content
func (*EnhancedHybridStore) GetMetadata ¶
func (hs *EnhancedHybridStore) GetMetadata(id string) string
GetMetadata returns a document's metadata
func (*EnhancedHybridStore) HybridSearch ¶
func (hs *EnhancedHybridStore) HybridSearch(queryVector []float32, queryText string, limit int) ([]HybridSearchResult, error)
HybridSearch performs a combined vector and text search
func (*EnhancedHybridStore) Load ¶
func (hs *EnhancedHybridStore) Load(path string) error
Load loads the store from a file
func (*EnhancedHybridStore) Remove ¶
func (hs *EnhancedHybridStore) Remove(id string)
Remove removes a document from both indexes
func (*EnhancedHybridStore) Save ¶
func (hs *EnhancedHybridStore) Save(vectorPath string) error
Save saves both indexes
func (*EnhancedHybridStore) Search ¶
func (hs *EnhancedHybridStore) Search(query []float32, limit int) []SearchResult
Search implements the basic vector search interface
type HNSWStore ¶
type HNSWStore struct {
// contains filtered or unexported fields
}
HNSWStore implements a vector store using a simpler approximation since the full HNSW algorithm isn't available
func NewHNSWStore ¶
NewHNSWStore creates a new vector store
type HybridSearchResult ¶
type HybridSearchResult struct {
ID string `json:"id"`
VectorScore float64 `json:"vector_score"`
TextScore float64 `json:"text_score"`
CombinedScore float64 `json:"combined_score"`
}
HybridSearchResult représente un résultat de recherche hybride
type SearchResult ¶
SearchResult represents a search result
type Store ¶
type Store struct {
Items []VectorItem `json:"items"`
}
Store is a simple vector storage with cosine similarity search
type VectorItem ¶
VectorItem represents an item in the vector storage