feat(nodejs): add bitmap and label list index types in nodejs (#1532)

This commit is contained in:
Lei Xu
2024-08-11 12:06:02 -07:00
committed by GitHub
parent b2317c904d
commit 694ca30c7c
4 changed files with 58 additions and 1 deletions

View File

@@ -176,6 +176,29 @@ export class Index {
return new Index(LanceDbIndex.btree());
}
/**
* Create a bitmap index.
*
* A `Bitmap` index stores a bitmap for each distinct value in the column for every row.
*
* This index works best for low-cardinality columns, where the number of unique values
* is small (i.e., less than a few hundreds).
*/
static bitmap() {
return new Index(LanceDbIndex.bitmap());
}
/**
* Create a label list index.
*
* LabelList index is a scalar index that can be used on `List<T>` columns to
* support queries with `array_contains_all` and `array_contains_any`
* using an underlying bitmap index.
*/
static labelList() {
return new Index(LanceDbIndex.labelList());
}
/**
* Create a full text search index
*

View File

@@ -151,7 +151,7 @@ export class QueryBase<NativeQueryType extends NativeQuery | NativeVectorQuery>
query: string,
options?: Partial<FullTextSearchOptions>,
): this {
let columns = null;
let columns: string[] | null = null;
if (options) {
if (typeof options.columns === "string") {
columns = [options.columns];