Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[faiss v1.7.1] Added high-level IVFFlatIndex impl #17

Merged
merged 7 commits into from
Jun 3, 2021
Merged
Changes from 1 commit
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
8 changes: 3 additions & 5 deletions src/index/ivf_flat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,18 @@ impl IVFFlatIndexImpl {
nlist as usize,
metric,
))?;
let own_fields_ = if own_fields { 1 } else { 0 };
faiss_IndexIVFFlat_set_own_fields(inner, own_fields_);

faiss_IndexIVFFlat_set_own_fields(inner, own_fields as i32);
Ok(IVFFlatIndexImpl { inner })
}
}

/// Create a new IVF flat index.
// The index owns the quantizer.
pub fn new(quantizer: flat::FlatIndex, d: u32, nlist: u32, metric: MetricType) -> Result<Self> {
let result = IVFFlatIndexImpl::new_helper(&quantizer, d, nlist, metric, true);
let index = IVFFlatIndexImpl::new_helper(&quantizer, d, nlist, metric, true)?;
std::mem::forget(quantizer);

result
Ok(index)
}

/// Create a new IVF flat index with L2 as the metric type.
Expand Down