Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ typ = "typ"
rabit = "rabit"
flate = "flate"

[default.expect]
nprobs = "nprobes"
nprob = "nprobe"

[files]
extend-exclude = ["notebooks/*.ipynb"]
# If a line ends with # or // and has spellchecker:disable-line, ignore it
4 changes: 2 additions & 2 deletions python/src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub mod commit;
pub mod optimize;
pub mod stats;

const DEFAULT_NPROBS: usize = 20;
const DEFAULT_NPROBES: usize = 20;
const LANCE_COMMIT_MESSAGE_KEY: &str = "__lance_commit_message";

fn convert_reader(reader: &Bound<PyAny>) -> PyResult<Box<dyn RecordBatchReader + Send>> {
Expand Down Expand Up @@ -981,7 +981,7 @@ impl Dataset {
10
};

let mut minimum_nprobes = DEFAULT_NPROBS;
let mut minimum_nprobes = DEFAULT_NPROBES;
let mut maximum_nprobes = None;

if let Some(nprobes) = nearest.get_item("nprobes")? {
Expand Down
4 changes: 2 additions & 2 deletions rust/lance/src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5246,7 +5246,7 @@ mod tests {
// let scan_fut = scan
// .nearest("vector", &query_vec, 2000)
// .unwrap()
// .nprobs(4)
// .nprobes(4)
// .prefilter(true)
// .try_into_stream()
// .await
Expand Down Expand Up @@ -5307,7 +5307,7 @@ mod tests {
let batches = scan
.nearest("vector", &query_vec, 2000)
.unwrap()
.nprobs(4)
.nprobes(4)
.prefilter(true)
.try_into_stream()
.await
Expand Down
15 changes: 15 additions & 0 deletions rust/lance/src/dataset/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,21 @@ impl Scanner {
///
/// This method is a convenience method that sets both [Self::minimum_nprobes] and
/// [Self::maximum_nprobes] to the same value.
pub fn nprobes(&mut self, n: usize) -> &mut Self {
if let Some(q) = self.nearest.as_mut() {
q.minimum_nprobes = n;
q.maximum_nprobes = Some(n);
} else {
log::warn!("nprobes is not set because nearest has not been called yet");
}
self
}

/// Configures how many partititions will be searched in the vector index.
///
/// This method is a convenience method that sets both [Self::minimum_nprobes] and
/// [Self::maximum_nprobes] to the same value.
#[deprecated(note = "Use nprobes instead")]
pub fn nprobs(&mut self, n: usize) -> &mut Self {
if let Some(q) = self.nearest.as_mut() {
q.minimum_nprobes = n;
Expand Down
2 changes: 1 addition & 1 deletion rust/lance/src/index/vector/ivf/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,7 @@ mod tests {
.scan()
.nearest(vector_column, query.as_primitive::<T>(), k)
.unwrap()
.nprobs(nlist)
.nprobes(nlist)
.with_row_id()
.try_into_batch()
.await
Expand Down
Loading