Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions segment_vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ package segment
import (
"encoding/json"

index "github.com/blevesearch/bleve_index_api"
"github.com/RoaringBitmap/roaring/v2"
index "github.com/blevesearch/bleve_index_api"
)

type VecPostingsList interface {
Expand Down Expand Up @@ -58,11 +58,18 @@ type VecPostingsIterator interface {
}

type VectorIndex interface {
// @params: Search params for backing vector index (like IVF, HNSW, etc.)
// Search performs a kNN search for the given query vector and returns a postings list.
// - qVector: the query vector
// - k: the number of similar vectors to return
// - params: additional search parameters
Search(qVector []float32, k int64, params json.RawMessage) (VecPostingsList, error)
// @eligibleDocIDs: DocIDs in the segment eligible for the kNN query.
SearchWithFilter(qVector []float32, k int64, eligibleDocIDs []uint64,
params json.RawMessage) (VecPostingsList, error)
// SearchWithFilter performs a kNN search for the given query vector, filtering results based on eligible documents
// - qVector: the query vector
// - k: the number of similar vectors to return
// - eligibleList: list of eligible documents to consider
// - params: additional search parameters
SearchWithFilter(qVector []float32, k int64, eligibleList index.EligibleDocumentList, params json.RawMessage) (VecPostingsList, error)
// Close releases any resources held by the VectorIndex.
Close()
Size() uint64

Expand All @@ -71,8 +78,7 @@ type VectorIndex interface {

type VectorSegment interface {
Segment
InterpretVectorIndex(field string, requiresFiltering bool, except *roaring.Bitmap) (
VectorIndex, error)
InterpretVectorIndex(field string, except *roaring.Bitmap) (VectorIndex, error)
}

type VecPosting interface {
Expand Down
Loading