Skip to content

Commit

Permalink
fix: the HNSW index doesn't respect to refine factor (#2122)
Browse files Browse the repository at this point in the history
Signed-off-by: BubbleCal <[email protected]>
  • Loading branch information
BubbleCal authored Mar 31, 2024
1 parent 874bf9c commit 2f4ed88
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rust/lance/src/index/vector/hnsw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ impl VectorIndex for HNSWIndex {
)
};

let ef = query.k + query.k / 2;
let k = query.k * query.refine_factor.unwrap_or(1) as usize;
let ef = k + k / 2;
let results = self.hnsw.search(
query.key.as_primitive::<Float32Type>().as_slice(),
query.k,
k,
ef,
bitmap,
)?;
Expand Down

0 comments on commit 2f4ed88

Please sign in to comment.