Skip to content

Commit

Permalink
better naming, err handling
Browse files Browse the repository at this point in the history
  • Loading branch information
metonymic-smokey committed Oct 16, 2024
1 parent e0c15b6 commit 6173079
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions faiss_vector_posting.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,25 +428,25 @@ func (sb *SegmentBase) InterpretVectorIndex(field string, requiresFiltering bool

var selector faiss.Selector
var err error
excludeVecIDs := make([]int64, 0, len(vecDocIDMap)-
vectorIDsToExclude := make([]int64, 0, len(vecDocIDMap)-
len(vectorIDsToInclude))
if float32(eligibleVecIDsBitmap.GetCardinality())/
float32(len(vecDocIDMap)) > 0.5 {
for _, eligibleDocID := range eligibleDocIDs {
vecIDs := docVecIDMap[uint32(eligibleDocID)]
for _, vecID := range vecIDs {
if !eligibleVecIDsBitmap.Contains(uint32(vecID)) {
excludeVecIDs = append(excludeVecIDs, (vecID))
vectorIDsToExclude = append(vectorIDsToExclude, (vecID))
}
}
}
selector, err = faiss.NewIDSelectorNot(excludeVecIDs)
if err != nil {
return nil, err
}
selector, err = faiss.NewIDSelectorNot(vectorIDsToExclude)
} else {
selector, err = faiss.NewIDSelectorBatch(vectorIDsToInclude)
}
if err != nil {
return nil, err
}

// Determining which clusters, identified by centroid ID,
// have at least one eligible vector and hence, ought to be
Expand Down

0 comments on commit 6173079

Please sign in to comment.