mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-08 21:02:58 +00:00
feat: remote index stats (#1702)
BREAKING CHANGE: the return value of `index_stats` method has changed and all `index_stats` APIs now take index name instead of UUID. Also several deprecated index statistics methods were removed. * Removes deprecated methods for individual index statistics * Aligns public `IndexStatistics` struct with API response from LanceDB Cloud. * Implements `index_stats` for remote Rust SDK and Python async API.
This commit is contained in:
@@ -724,9 +724,9 @@ export interface VectorIndex {
|
||||
export interface IndexStats {
|
||||
numIndexedRows: number | null
|
||||
numUnindexedRows: number | null
|
||||
indexType: string | null
|
||||
distanceType: string | null
|
||||
completedAt: string | null
|
||||
indexType: string
|
||||
distanceType?: string
|
||||
numIndices?: number
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,7 +112,7 @@ export class Query<T = number[]> {
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Skip searching un-indexed data. This can make search faster, but will miss
|
||||
* any data that is not yet indexed.
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,7 @@ import axios, { type AxiosResponse, type ResponseType } from 'axios'
|
||||
import { tableFromIPC, type Table as ArrowTable } from 'apache-arrow'
|
||||
|
||||
import { type RemoteResponse, type RemoteRequest, Method } from '../middleware'
|
||||
import { MetricType } from '..'
|
||||
import type { MetricType } from '..'
|
||||
|
||||
interface HttpLancedbClientMiddleware {
|
||||
onRemoteRequest(
|
||||
|
||||
@@ -526,8 +526,7 @@ export class RemoteTable<T = number[]> implements Table<T> {
|
||||
numIndexedRows: body?.num_indexed_rows,
|
||||
numUnindexedRows: body?.num_unindexed_rows,
|
||||
indexType: body?.index_type,
|
||||
distanceType: body?.distance_type,
|
||||
completedAt: body?.completed_at
|
||||
distanceType: body?.distance_type
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -888,9 +888,12 @@ describe("LanceDB client", function () {
|
||||
expect(indices[0].columns).to.have.lengthOf(1);
|
||||
expect(indices[0].columns[0]).to.equal("vector");
|
||||
|
||||
const stats = await table.indexStats(indices[0].uuid);
|
||||
const stats = await table.indexStats(indices[0].name);
|
||||
expect(stats.numIndexedRows).to.equal(300);
|
||||
expect(stats.numUnindexedRows).to.equal(0);
|
||||
expect(stats.indexType).to.equal("IVF_PQ");
|
||||
expect(stats.distanceType).to.equal("l2");
|
||||
expect(stats.numIndices).to.equal(1);
|
||||
}).timeout(50_000);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user