@lancedb/lancedb 0.15.1-beta.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,8 @@ export interface CreateTableOptions {
32
32
  *
33
33
  * The default is `stable`.
34
34
  * Set to "legacy" to use the old format.
35
+ *
36
+ * @deprecated Pass `new_table_data_storage_version` to storageOptions instead.
35
37
  */
36
38
  dataStorageVersion?: string;
37
39
  /**
@@ -40,16 +42,10 @@ export interface CreateTableOptions {
40
42
  * turning this on will make the dataset unreadable for older versions
41
43
  * of LanceDB (prior to 0.10.0). To migrate an existing dataset, instead
42
44
  * use the {@link LocalTable#migrateManifestPathsV2} method.
43
- */
44
- enableV2ManifestPaths?: boolean;
45
- /**
46
- * If true then data files will be written with the legacy format
47
45
  *
48
- * The default is false.
49
- *
50
- * Deprecated. Use data storage version instead.
46
+ * @deprecated Pass `new_table_enable_v2_manifest_paths` to storageOptions instead.
51
47
  */
52
- useLegacyFormat?: boolean;
48
+ enableV2ManifestPaths?: boolean;
53
49
  schema?: SchemaLike;
54
50
  embeddingFunction?: EmbeddingFunctionConfig;
55
51
  }
@@ -105,6 +101,7 @@ export interface TableNamesOptions {
105
101
  *
106
102
  * Any created tables are independent and will continue to work even if
107
103
  * the underlying connection has been closed.
104
+ * @hideconstructor
108
105
  */
109
106
  export declare abstract class Connection {
110
107
  /**
@@ -166,21 +163,29 @@ export declare abstract class Connection {
166
163
  * @param {string} name The name of the table to drop.
167
164
  */
168
165
  abstract dropTable(name: string): Promise<void>;
166
+ /**
167
+ * Drop all tables in the database.
168
+ */
169
+ abstract dropAllTables(): Promise<void>;
169
170
  }
171
+ /** @hideconstructor */
170
172
  export declare class LocalConnection extends Connection {
171
173
  readonly inner: LanceDbConnection;
174
+ /** @hidden */
172
175
  constructor(inner: LanceDbConnection);
173
176
  isOpen(): boolean;
174
177
  close(): void;
175
178
  display(): string;
176
179
  tableNames(options?: Partial<TableNamesOptions>): Promise<string[]>;
177
180
  openTable(name: string, options?: Partial<OpenTableOptions>): Promise<Table>;
181
+ private getStorageOptions;
178
182
  createTable(nameOrOptions: string | ({
179
183
  name: string;
180
184
  data: Data;
181
185
  } & Partial<CreateTableOptions>), data?: Record<string, unknown>[] | TableLike, options?: Partial<CreateTableOptions>): Promise<Table>;
182
186
  createEmptyTable(name: string, schema: import("./arrow").SchemaLike, options?: Partial<CreateTableOptions>): Promise<Table>;
183
187
  dropTable(name: string): Promise<void>;
188
+ dropAllTables(): Promise<void>;
184
189
  }
185
190
  /**
186
191
  * Takes storage options and makes all the keys snake case.
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.LocalConnection = exports.Connection = void 0;
6
6
  exports.cleanseStorageOptions = cleanseStorageOptions;
7
7
  const arrow_1 = require("./arrow");
8
+ const arrow_2 = require("./arrow");
8
9
  const registry_1 = require("./embedding/registry");
10
+ const sanitize_1 = require("./sanitize");
9
11
  const table_1 = require("./table");
10
12
  /**
11
13
  * A LanceDB Connection that allows you to open tables and create new ones.
@@ -24,6 +26,7 @@ const table_1 = require("./table");
24
26
  *
25
27
  * Any created tables are independent and will continue to work even if
26
28
  * the underlying connection has been closed.
29
+ * @hideconstructor
27
30
  */
28
31
  class Connection {
29
32
  [Symbol.for("nodejs.util.inspect.custom")]() {
@@ -31,8 +34,10 @@ class Connection {
31
34
  }
32
35
  }
33
36
  exports.Connection = Connection;
37
+ /** @hideconstructor */
34
38
  class LocalConnection extends Connection {
35
39
  inner;
40
+ /** @hidden */
36
41
  constructor(inner) {
37
42
  super();
38
43
  this.inner = inner;
@@ -53,6 +58,23 @@ class LocalConnection extends Connection {
53
58
  const innerTable = await this.inner.openTable(name, cleanseStorageOptions(options?.storageOptions), options?.indexCacheSize);
54
59
  return new table_1.LocalTable(innerTable);
55
60
  }
61
+ getStorageOptions(options) {
62
+ if (options?.dataStorageVersion !== undefined) {
63
+ if (options.storageOptions === undefined) {
64
+ options.storageOptions = {};
65
+ }
66
+ options.storageOptions["newTableDataStorageVersion"] =
67
+ options.dataStorageVersion;
68
+ }
69
+ if (options?.enableV2ManifestPaths !== undefined) {
70
+ if (options.storageOptions === undefined) {
71
+ options.storageOptions = {};
72
+ }
73
+ options.storageOptions["newTableEnableV2ManifestPaths"] =
74
+ options.enableV2ManifestPaths ? "true" : "false";
75
+ }
76
+ return cleanseStorageOptions(options?.storageOptions);
77
+ }
56
78
  async createTable(nameOrOptions, data, options) {
57
79
  if (typeof nameOrOptions !== "string" && "name" in nameOrOptions) {
58
80
  const { name, data, ...options } = nameOrOptions;
@@ -61,15 +83,9 @@ class LocalConnection extends Connection {
61
83
  if (data === undefined) {
62
84
  throw new Error("data is required");
63
85
  }
64
- const { buf, mode } = await table_1.Table.parseTableData(data, options);
65
- let dataStorageVersion = "stable";
66
- if (options?.dataStorageVersion !== undefined) {
67
- dataStorageVersion = options.dataStorageVersion;
68
- }
69
- else if (options?.useLegacyFormat !== undefined) {
70
- dataStorageVersion = options.useLegacyFormat ? "legacy" : "stable";
71
- }
72
- const innerTable = await this.inner.createTable(nameOrOptions, buf, mode, cleanseStorageOptions(options?.storageOptions), dataStorageVersion, options?.enableV2ManifestPaths);
86
+ const { buf, mode } = await parseTableData(data, options);
87
+ const storageOptions = this.getStorageOptions(options);
88
+ const innerTable = await this.inner.createTable(nameOrOptions, buf, mode, storageOptions);
73
89
  return new table_1.LocalTable(innerTable);
74
90
  }
75
91
  async createEmptyTable(name, schema, options) {
@@ -84,21 +100,18 @@ class LocalConnection extends Connection {
84
100
  const registry = (0, registry_1.getRegistry)();
85
101
  metadata = registry.getTableMetadata([embeddingFunction]);
86
102
  }
87
- let dataStorageVersion = "stable";
88
- if (options?.dataStorageVersion !== undefined) {
89
- dataStorageVersion = options.dataStorageVersion;
90
- }
91
- else if (options?.useLegacyFormat !== undefined) {
92
- dataStorageVersion = options.useLegacyFormat ? "legacy" : "stable";
93
- }
94
- const table = (0, arrow_1.makeEmptyTable)(schema, metadata);
95
- const buf = await (0, arrow_1.fromTableToBuffer)(table);
96
- const innerTable = await this.inner.createEmptyTable(name, buf, mode, cleanseStorageOptions(options?.storageOptions), dataStorageVersion, options?.enableV2ManifestPaths);
103
+ const storageOptions = this.getStorageOptions(options);
104
+ const table = (0, arrow_2.makeEmptyTable)(schema, metadata);
105
+ const buf = await (0, arrow_2.fromTableToBuffer)(table);
106
+ const innerTable = await this.inner.createEmptyTable(name, buf, mode, storageOptions);
97
107
  return new table_1.LocalTable(innerTable);
98
108
  }
99
109
  async dropTable(name) {
100
110
  return this.inner.dropTable(name);
101
111
  }
112
+ async dropAllTables() {
113
+ return this.inner.dropAllTables();
114
+ }
102
115
  }
103
116
  exports.LocalConnection = LocalConnection;
104
117
  /**
@@ -136,3 +149,25 @@ function camelToSnakeCase(camel) {
136
149
  }
137
150
  return result;
138
151
  }
152
+ async function parseTableData(data, options, streaming = false) {
153
+ let mode = options?.mode ?? "create";
154
+ const existOk = options?.existOk ?? false;
155
+ if (mode === "create" && existOk) {
156
+ mode = "exist_ok";
157
+ }
158
+ let table;
159
+ if ((0, arrow_1.isArrowTable)(data)) {
160
+ table = (0, sanitize_1.sanitizeTable)(data);
161
+ }
162
+ else {
163
+ table = (0, arrow_1.makeArrowTable)(data, options);
164
+ }
165
+ if (streaming) {
166
+ const buf = await (0, arrow_1.fromTableToStreamBuffer)(table, options?.embeddingFunction, options?.schema);
167
+ return { buf, mode };
168
+ }
169
+ else {
170
+ const buf = await (0, arrow_2.fromTableToBuffer)(table, options?.embeddingFunction, options?.schema);
171
+ return { buf, mode };
172
+ }
173
+ }
@@ -50,15 +50,15 @@ export declare abstract class EmbeddingFunction<T = any, M extends FunctionOptio
50
50
  *
51
51
  * @param optionsOrDatatype - The options for the field or the datatype
52
52
  *
53
- * @see {@link lancedb.LanceSchema}
53
+ * @see {@link LanceSchema}
54
54
  */
55
55
  sourceField(optionsOrDatatype: Partial<FieldOptions> | DataType): [DataType, Map<string, EmbeddingFunction>];
56
56
  /**
57
57
  * vectorField is used in combination with `LanceSchema` to provide a declarative data model
58
58
  *
59
- * @param options - The options for the field
59
+ * @param optionsOrDatatype - The options for the field
60
60
  *
61
- * @see {@link lancedb.LanceSchema}
61
+ * @see {@link LanceSchema}
62
62
  */
63
63
  vectorField(optionsOrDatatype?: Partial<FieldOptions> | DataType): [DataType, Map<string, EmbeddingFunction>];
64
64
  /** The number of dimensions of the embeddings */
@@ -21,7 +21,7 @@ class EmbeddingFunction {
21
21
  *
22
22
  * @param optionsOrDatatype - The options for the field or the datatype
23
23
  *
24
- * @see {@link lancedb.LanceSchema}
24
+ * @see {@link LanceSchema}
25
25
  */
26
26
  sourceField(optionsOrDatatype) {
27
27
  let datatype = "datatype" in optionsOrDatatype
@@ -38,9 +38,9 @@ class EmbeddingFunction {
38
38
  /**
39
39
  * vectorField is used in combination with `LanceSchema` to provide a declarative data model
40
40
  *
41
- * @param options - The options for the field
41
+ * @param optionsOrDatatype - The options for the field
42
42
  *
43
- * @see {@link lancedb.LanceSchema}
43
+ * @see {@link LanceSchema}
44
44
  */
45
45
  vectorField(optionsOrDatatype) {
46
46
  let dtype;
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "../arrow";
2
2
  import { EmbeddingFunction } from "./embedding_function";
3
- export { EmbeddingFunction, TextEmbeddingFunction } from "./embedding_function";
3
+ export { FieldOptions, EmbeddingFunction, TextEmbeddingFunction, FunctionOptions, EmbeddingFunctionConstructor, } from "./embedding_function";
4
4
  export * from "./registry";
5
5
  /**
6
6
  * Create a schema with embedding functions.
@@ -1,9 +1,9 @@
1
1
  import { type EmbeddingFunction, type EmbeddingFunctionConstructor } from "./embedding_function";
2
2
  import "reflect-metadata";
3
- type CreateReturnType<T> = T extends {
3
+ export type CreateReturnType<T> = T extends {
4
4
  init: () => Promise<void>;
5
5
  } ? Promise<T> : T;
6
- interface EmbeddingFunctionCreate<T extends EmbeddingFunction> {
6
+ export interface EmbeddingFunctionCreate<T extends EmbeddingFunction> {
7
7
  create(options?: T["TOptions"]): CreateReturnType<T>;
8
8
  }
9
9
  /**
@@ -20,8 +20,6 @@ export declare class EmbeddingFunctionRegistry {
20
20
  length(): number;
21
21
  /**
22
22
  * Register an embedding function
23
- * @param name The name of the function
24
- * @param func The function to register
25
23
  * @throws Error if the function is already registered
26
24
  */
27
25
  register<T extends EmbeddingFunctionConstructor = EmbeddingFunctionConstructor>(this: EmbeddingFunctionRegistry, alias?: string): (ctor: T) => any;
@@ -52,4 +50,3 @@ export interface EmbeddingFunctionConfig {
52
50
  vectorColumn?: string;
53
51
  function: EmbeddingFunction;
54
52
  }
55
- export {};
@@ -22,8 +22,6 @@ class EmbeddingFunctionRegistry {
22
22
  }
23
23
  /**
24
24
  * Register an embedding function
25
- * @param name The name of the function
26
- * @param func The function to register
27
25
  * @throws Error if the function is already registered
28
26
  */
29
27
  register(alias) {
package/dist/index.d.ts CHANGED
@@ -1,13 +1,16 @@
1
1
  import { Connection } from "./connection";
2
2
  import { ConnectionOptions } from "./native.js";
3
- export { WriteOptions, WriteMode, AddColumnsSql, ColumnAlteration, ConnectionOptions, IndexStatistics, IndexConfig, ClientConfig, TimeoutConfig, RetryConfig, } from "./native.js";
3
+ export { AddColumnsSql, ColumnAlteration, ConnectionOptions, IndexStatistics, IndexConfig, ClientConfig, TimeoutConfig, RetryConfig, OptimizeStats, CompactionStats, RemovalStats, } from "./native.js";
4
4
  export { makeArrowTable, MakeArrowTableOptions, Data, VectorColumnOptions, } from "./arrow";
5
- export { Connection, CreateTableOptions, TableNamesOptions, } from "./connection";
6
- export { ExecutableQuery, Query, QueryBase, VectorQuery, RecordBatchIterator, } from "./query";
7
- export { Index, IndexOptions, IvfPqOptions } from "./indices";
8
- export { Table, AddDataOptions, UpdateOptions, OptimizeOptions } from "./table";
5
+ export { Connection, CreateTableOptions, TableNamesOptions, OpenTableOptions, } from "./connection";
6
+ export { ExecutableQuery, Query, QueryBase, VectorQuery, QueryExecutionOptions, FullTextSearchOptions, RecordBatchIterator, } from "./query";
7
+ export { Index, IndexOptions, IvfPqOptions, HnswPqOptions, HnswSqOptions, FtsOptions, } from "./indices";
8
+ export { Table, AddDataOptions, UpdateOptions, OptimizeOptions, Version, } from "./table";
9
+ export { MergeInsertBuilder } from "./merge";
9
10
  export * as embedding from "./embedding";
10
11
  export * as rerankers from "./rerankers";
12
+ export { SchemaLike, TableLike, FieldLike, RecordBatchLike, DataLike, IntoVector, } from "./arrow";
13
+ export { IntoSql } from "./util";
11
14
  /**
12
15
  * Connect to a LanceDB instance at the given URI.
13
16
  *
@@ -19,6 +22,7 @@ export * as rerankers from "./rerankers";
19
22
  * @param {string} uri - The uri of the database. If the database uri starts
20
23
  * with `db://` then it connects to a remote database.
21
24
  * @see {@link ConnectionOptions} for more details on the URI format.
25
+ * @param options - The options to use when connecting to the database
22
26
  * @example
23
27
  * ```ts
24
28
  * const conn = await connect("/path/to/database");
@@ -31,7 +35,7 @@ export * as rerankers from "./rerankers";
31
35
  * });
32
36
  * ```
33
37
  */
34
- export declare function connect(uri: string, opts?: Partial<ConnectionOptions>): Promise<Connection>;
38
+ export declare function connect(uri: string, options?: Partial<ConnectionOptions>): Promise<Connection>;
35
39
  /**
36
40
  * Connect to a LanceDB instance at the given URI.
37
41
  *
@@ -50,6 +54,6 @@ export declare function connect(uri: string, opts?: Partial<ConnectionOptions>):
50
54
  * });
51
55
  * ```
52
56
  */
53
- export declare function connect(opts: Partial<ConnectionOptions> & {
57
+ export declare function connect(options: Partial<ConnectionOptions> & {
54
58
  uri: string;
55
59
  }): Promise<Connection>;
package/dist/index.js CHANGED
@@ -2,12 +2,10 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  // SPDX-FileCopyrightText: Copyright The LanceDB Authors
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.rerankers = exports.embedding = exports.Table = exports.Index = exports.RecordBatchIterator = exports.VectorQuery = exports.QueryBase = exports.Query = exports.Connection = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeArrowTable = exports.WriteMode = void 0;
5
+ exports.rerankers = exports.embedding = exports.MergeInsertBuilder = exports.Table = exports.Index = exports.RecordBatchIterator = exports.VectorQuery = exports.QueryBase = exports.Query = exports.Connection = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeArrowTable = void 0;
6
6
  exports.connect = connect;
7
7
  const connection_1 = require("./connection");
8
8
  const native_js_1 = require("./native.js");
9
- var native_js_2 = require("./native.js");
10
- Object.defineProperty(exports, "WriteMode", { enumerable: true, get: function () { return native_js_2.WriteMode; } });
11
9
  var arrow_1 = require("./arrow");
12
10
  Object.defineProperty(exports, "makeArrowTable", { enumerable: true, get: function () { return arrow_1.makeArrowTable; } });
13
11
  Object.defineProperty(exports, "MakeArrowTableOptions", { enumerable: true, get: function () { return arrow_1.MakeArrowTableOptions; } });
@@ -23,14 +21,16 @@ var indices_1 = require("./indices");
23
21
  Object.defineProperty(exports, "Index", { enumerable: true, get: function () { return indices_1.Index; } });
24
22
  var table_1 = require("./table");
25
23
  Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return table_1.Table; } });
24
+ var merge_1 = require("./merge");
25
+ Object.defineProperty(exports, "MergeInsertBuilder", { enumerable: true, get: function () { return merge_1.MergeInsertBuilder; } });
26
26
  exports.embedding = require("./embedding");
27
27
  exports.rerankers = require("./rerankers");
28
- async function connect(uriOrOptions, opts = {}) {
28
+ async function connect(uriOrOptions, options = {}) {
29
29
  let uri;
30
30
  if (typeof uriOrOptions !== "string") {
31
- const { uri: uri_, ...options } = uriOrOptions;
31
+ const { uri: uri_, ...opts } = uriOrOptions;
32
32
  uri = uri_;
33
- opts = options;
33
+ options = opts;
34
34
  }
35
35
  else {
36
36
  uri = uriOrOptions;
@@ -38,8 +38,8 @@ async function connect(uriOrOptions, opts = {}) {
38
38
  if (!uri) {
39
39
  throw new Error("uri is required");
40
40
  }
41
- opts = opts ?? {};
42
- opts.storageOptions = (0, connection_1.cleanseStorageOptions)(opts.storageOptions);
43
- const nativeConn = await native_js_1.Connection.new(uri, opts);
41
+ options = options ?? {};
42
+ options.storageOptions = (0, connection_1.cleanseStorageOptions)(options.storageOptions);
43
+ const nativeConn = await native_js_1.Connection.new(uri, options);
44
44
  return new connection_1.LocalConnection(nativeConn);
45
45
  }
package/dist/indices.d.ts CHANGED
@@ -426,8 +426,6 @@ export declare class Index {
426
426
  * The results of a full text search are ordered by relevance measured by BM25.
427
427
  *
428
428
  * You can combine filters with full text search.
429
- *
430
- * For now, the full text search index only supports English, and doesn't support phrase search.
431
429
  */
432
430
  static fts(options?: Partial<FtsOptions>): Index;
433
431
  /**
package/dist/indices.js CHANGED
@@ -86,8 +86,6 @@ class Index {
86
86
  * The results of a full text search are ordered by relevance measured by BM25.
87
87
  *
88
88
  * You can combine filters with full text search.
89
- *
90
- * For now, the full text search index only supports English, and doesn't support phrase search.
91
89
  */
92
90
  static fts(options) {
93
91
  return new Index(native_1.Index.fts(options?.withPosition, options?.baseTokenizer, options?.language, options?.maxTokenLength, options?.lowercase, options?.stem, options?.removeStopWords, options?.asciiFolding));
package/dist/native.d.ts CHANGED
@@ -77,6 +77,7 @@ export interface ClientConfig {
77
77
  userAgent?: string
78
78
  retryConfig?: RetryConfig
79
79
  timeoutConfig?: TimeoutConfig
80
+ extraHeaders?: Record<string, string>
80
81
  }
81
82
  export interface RerankerCallbacks {
82
83
  rerankHybrid: (...args: any[]) => any
@@ -228,17 +229,6 @@ export interface ConnectionOptions {
228
229
  */
229
230
  hostOverride?: string
230
231
  }
231
- /** Write mode for writing a table. */
232
- export enum WriteMode {
233
- Create = 'Create',
234
- Append = 'Append',
235
- Overwrite = 'Overwrite'
236
- }
237
- /** Write options when creating a Table. */
238
- export interface WriteOptions {
239
- /** Write mode for writing to a table. */
240
- mode?: WriteMode
241
- }
242
232
  export interface OpenTableOptions {
243
233
  storageOptions?: Record<string, string>
244
234
  }
@@ -258,11 +248,12 @@ export class Connection {
258
248
  * - buf: The buffer containing the IPC file.
259
249
  *
260
250
  */
261
- createTable(name: string, buf: Buffer, mode: string, storageOptions?: Record<string, string> | undefined | null, dataStorageOptions?: string | undefined | null, enableV2ManifestPaths?: boolean | undefined | null): Promise<Table>
262
- createEmptyTable(name: string, schemaBuf: Buffer, mode: string, storageOptions?: Record<string, string> | undefined | null, dataStorageOptions?: string | undefined | null, enableV2ManifestPaths?: boolean | undefined | null): Promise<Table>
251
+ createTable(name: string, buf: Buffer, mode: string, storageOptions?: Record<string, string> | undefined | null): Promise<Table>
252
+ createEmptyTable(name: string, schemaBuf: Buffer, mode: string, storageOptions?: Record<string, string> | undefined | null): Promise<Table>
263
253
  openTable(name: string, storageOptions?: Record<string, string> | undefined | null, indexCacheSize?: number | undefined | null): Promise<Table>
264
254
  /** Drop table with the name. Or raise an error if the table does not exist. */
265
255
  dropTable(name: string): Promise<void>
256
+ dropAllTables(): Promise<void>
266
257
  }
267
258
  export class Index {
268
259
  static ivfPq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, numSubVectors?: number | undefined | null, numBits?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null): Index
package/dist/native.js CHANGED
@@ -319,7 +319,7 @@ if (!nativeBinding) {
319
319
  }
320
320
  throw new Error(`Failed to load native binding`);
321
321
  }
322
- const { Connection, Index, RecordBatchIterator, NativeMergeInsertBuilder, Query, VectorQuery, Reranker, RrfReranker, Table, WriteMode } = nativeBinding;
322
+ const { Connection, Index, RecordBatchIterator, NativeMergeInsertBuilder, Query, VectorQuery, Reranker, RrfReranker, Table } = nativeBinding;
323
323
  module.exports.Connection = Connection;
324
324
  module.exports.Index = Index;
325
325
  module.exports.RecordBatchIterator = RecordBatchIterator;
@@ -329,4 +329,3 @@ module.exports.VectorQuery = VectorQuery;
329
329
  module.exports.Reranker = Reranker;
330
330
  module.exports.RrfReranker = RrfReranker;
331
331
  module.exports.Table = Table;
332
- module.exports.WriteMode = WriteMode;
package/dist/query.d.ts CHANGED
@@ -32,10 +32,22 @@ export interface FullTextSearchOptions {
32
32
  */
33
33
  columns?: string | string[];
34
34
  }
35
- /** Common methods supported by all query types */
35
+ /** Common methods supported by all query types
36
+ *
37
+ * @see {@link Query}
38
+ * @see {@link VectorQuery}
39
+ *
40
+ * @hideconstructor
41
+ */
36
42
  export declare class QueryBase<NativeQueryType extends NativeQuery | NativeVectorQuery> implements AsyncIterable<RecordBatch> {
37
43
  protected inner: NativeQueryType | Promise<NativeQueryType>;
44
+ /**
45
+ * @hidden
46
+ */
38
47
  protected constructor(inner: NativeQueryType | Promise<NativeQueryType>);
48
+ /**
49
+ * @hidden
50
+ */
39
51
  protected doCall(fn: (inner: NativeQueryType) => void): void;
40
52
  /**
41
53
  * A filter statement to be applied to this query.
@@ -52,7 +64,7 @@ export declare class QueryBase<NativeQueryType extends NativeQuery | NativeVecto
52
64
  where(predicate: string): this;
53
65
  /**
54
66
  * A filter statement to be applied to this query.
55
- * @alias where
67
+ * @see where
56
68
  * @deprecated Use `where` instead
57
69
  */
58
70
  filter(predicate: string): this;
@@ -100,7 +112,7 @@ export declare class QueryBase<NativeQueryType extends NativeQuery | NativeVecto
100
112
  * Skip searching un-indexed data. This can make search faster, but will miss
101
113
  * any data that is not yet indexed.
102
114
  *
103
- * Use {@link lancedb.Table#optimize} to index all un-indexed data.
115
+ * Use {@link Table#optimize} to index all un-indexed data.
104
116
  */
105
117
  fastSearch(): this;
106
118
  /**
@@ -111,6 +123,9 @@ export declare class QueryBase<NativeQueryType extends NativeQuery | NativeVecto
111
123
  * order to perform hybrid search.
112
124
  */
113
125
  withRowId(): this;
126
+ /**
127
+ * @hidden
128
+ */
114
129
  protected nativeExecute(options?: Partial<QueryExecutionOptions>): Promise<NativeBatchIterator>;
115
130
  /**
116
131
  * Execute the query and return the results as an @see {@link AsyncIterator}
@@ -124,6 +139,9 @@ export declare class QueryBase<NativeQueryType extends NativeQuery | NativeVecto
124
139
  *
125
140
  */
126
141
  protected execute(options?: Partial<QueryExecutionOptions>): RecordBatchIterator;
142
+ /**
143
+ * @hidden
144
+ */
127
145
  [Symbol.asyncIterator](): AsyncIterator<RecordBatch<any>>;
128
146
  /** Collect the results as an Arrow @see {@link ArrowTable}. */
129
147
  toArrow(options?: Partial<QueryExecutionOptions>): Promise<ArrowTable>;
@@ -156,8 +174,15 @@ export interface ExecutableQuery {
156
174
  * A builder used to construct a vector search
157
175
  *
158
176
  * This builder can be reused to execute the query many times.
177
+ *
178
+ * @see {@link Query#nearestTo}
179
+ *
180
+ * @hideconstructor
159
181
  */
160
182
  export declare class VectorQuery extends QueryBase<NativeVectorQuery> {
183
+ /**
184
+ * @hidden
185
+ */
161
186
  constructor(inner: NativeVectorQuery | Promise<NativeVectorQuery>);
162
187
  /**
163
188
  * Set the number of partitions to search (probe)
@@ -282,8 +307,16 @@ export declare class VectorQuery extends QueryBase<NativeVectorQuery> {
282
307
  addQueryVector(vector: IntoVector): VectorQuery;
283
308
  rerank(reranker: Reranker): VectorQuery;
284
309
  }
285
- /** A builder for LanceDB queries. */
310
+ /** A builder for LanceDB queries.
311
+ *
312
+ * @see {@link Table#query}, {@link Table#search}
313
+ *
314
+ * @hideconstructor
315
+ */
286
316
  export declare class Query extends QueryBase<NativeQuery> {
317
+ /**
318
+ * @hidden
319
+ */
287
320
  constructor(tbl: NativeTable);
288
321
  /**
289
322
  * Find the nearest vectors to the given query vector.
package/dist/query.js CHANGED
@@ -44,14 +44,26 @@ class RecordBatchIterable {
44
44
  return new RecordBatchIterator(this.inner.execute(this.options?.maxBatchLength));
45
45
  }
46
46
  }
47
- /** Common methods supported by all query types */
47
+ /** Common methods supported by all query types
48
+ *
49
+ * @see {@link Query}
50
+ * @see {@link VectorQuery}
51
+ *
52
+ * @hideconstructor
53
+ */
48
54
  class QueryBase {
49
55
  inner;
56
+ /**
57
+ * @hidden
58
+ */
50
59
  constructor(inner) {
51
60
  this.inner = inner;
52
61
  // intentionally empty
53
62
  }
54
63
  // call a function on the inner (either a promise or the actual object)
64
+ /**
65
+ * @hidden
66
+ */
55
67
  doCall(fn) {
56
68
  if (this.inner instanceof Promise) {
57
69
  this.inner = this.inner.then((inner) => {
@@ -81,7 +93,7 @@ class QueryBase {
81
93
  }
82
94
  /**
83
95
  * A filter statement to be applied to this query.
84
- * @alias where
96
+ * @see where
85
97
  * @deprecated Use `where` instead
86
98
  */
87
99
  filter(predicate) {
@@ -173,7 +185,7 @@ class QueryBase {
173
185
  * Skip searching un-indexed data. This can make search faster, but will miss
174
186
  * any data that is not yet indexed.
175
187
  *
176
- * Use {@link lancedb.Table#optimize} to index all un-indexed data.
188
+ * Use {@link Table#optimize} to index all un-indexed data.
177
189
  */
178
190
  fastSearch() {
179
191
  this.doCall((inner) => inner.fastSearch());
@@ -190,6 +202,9 @@ class QueryBase {
190
202
  this.doCall((inner) => inner.withRowId());
191
203
  return this;
192
204
  }
205
+ /**
206
+ * @hidden
207
+ */
193
208
  nativeExecute(options) {
194
209
  if (this.inner instanceof Promise) {
195
210
  return this.inner.then((inner) => inner.execute(options?.maxBatchLength));
@@ -212,6 +227,9 @@ class QueryBase {
212
227
  execute(options) {
213
228
  return new RecordBatchIterator(this.nativeExecute(options));
214
229
  }
230
+ /**
231
+ * @hidden
232
+ */
215
233
  // biome-ignore lint/suspicious/noExplicitAny: skip
216
234
  [Symbol.asyncIterator]() {
217
235
  const promise = this.nativeExecute();
@@ -266,8 +284,15 @@ exports.QueryBase = QueryBase;
266
284
  * A builder used to construct a vector search
267
285
  *
268
286
  * This builder can be reused to execute the query many times.
287
+ *
288
+ * @see {@link Query#nearestTo}
289
+ *
290
+ * @hideconstructor
269
291
  */
270
292
  class VectorQuery extends QueryBase {
293
+ /**
294
+ * @hidden
295
+ */
271
296
  constructor(inner) {
272
297
  super(inner);
273
298
  }
@@ -472,8 +497,16 @@ class VectorQuery extends QueryBase {
472
497
  }
473
498
  }
474
499
  exports.VectorQuery = VectorQuery;
475
- /** A builder for LanceDB queries. */
500
+ /** A builder for LanceDB queries.
501
+ *
502
+ * @see {@link Table#query}, {@link Table#search}
503
+ *
504
+ * @hideconstructor
505
+ */
476
506
  class Query extends QueryBase {
507
+ /**
508
+ * @hidden
509
+ */
477
510
  constructor(tbl) {
478
511
  super(tbl.query());
479
512
  }
@@ -3,10 +3,11 @@ import { RrfReranker as NativeRRFReranker } from "../native";
3
3
  /**
4
4
  * Reranks the results using the Reciprocal Rank Fusion (RRF) algorithm.
5
5
  *
6
- * Internally this uses the Rust implementation
6
+ * @hideconstructor
7
7
  */
8
8
  export declare class RRFReranker {
9
9
  private inner;
10
+ /** @ignore */
10
11
  constructor(inner: NativeRRFReranker);
11
12
  static create(k?: number): Promise<RRFReranker>;
12
13
  rerankHybrid(query: string, vecResults: RecordBatch, ftsResults: RecordBatch): Promise<RecordBatch>;
@@ -8,10 +8,11 @@ const native_1 = require("../native");
8
8
  /**
9
9
  * Reranks the results using the Reciprocal Rank Fusion (RRF) algorithm.
10
10
  *
11
- * Internally this uses the Rust implementation
11
+ * @hideconstructor
12
12
  */
13
13
  class RRFReranker {
14
14
  inner;
15
+ /** @ignore */
15
16
  constructor(inner) {
16
17
  this.inner = inner;
17
18
  }