Skip to content

Commit

Permalink
add once instead of many times to bitmap
Browse files Browse the repository at this point in the history
  • Loading branch information
metonymic-smokey committed Oct 15, 2024
1 parent 0c6f397 commit f785f6c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion faiss_vector_posting.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,14 @@ func (sb *SegmentBase) InterpretVectorIndex(field string, requiresFiltering bool
// Getting the vector IDs corresponding to the eligible
// doc IDs.
eligibleVecIDsBitmap := roaring.NewBitmap()
vecIDsUint32 := make([]uint32, 0)
for _, eligibleDocID := range eligibleDocIDs {
vecIDs := docVecIDMap[uint32(eligibleDocID)]
for _, vecID := range vecIDs {
eligibleVecIDsBitmap.Add(uint32(vecID))
vecIDsUint32 = append(vecIDsUint32, uint32(vecID))
}
}
eligibleVecIDsBitmap.AddMany(vecIDsUint32)

// Determining which clusters, identified by centroid ID,
// have at least one eligible vector and hence, ought to be
Expand Down Expand Up @@ -464,6 +466,9 @@ func (sb *SegmentBase) InterpretVectorIndex(field string, requiresFiltering bool
minEligibleCentroids = i + 1
}

// If the fraction of eligible vec IDs is greater than 50%,
// use an exclude selector instead for the ineligible IDs.

// Search the clusters specified by 'closestCentroidIDs' for
// vectors whose IDs are present in 'vectorIDsToInclude'
scores, ids, err := vecIndex.SearchClustersFromIVFIndex(
Expand Down

0 comments on commit f785f6c

Please sign in to comment.