Skip to content

vectordb / Exports / Query

Class: Query\<T>

A builder for nearest neighbor queries for LanceDB.

Type parameters

Name Type
T number[]

Table of contents

Constructors

Properties

Methods

Constructors

constructor

β€’ new Query\<T>(query?, tbl?, embeddings?)

Type parameters

Name Type
T number[]

Parameters

Name Type
query? T
tbl? any
embeddings? EmbeddingFunction\<T>

Defined in

query.ts:39

Properties

_embeddings

β€’ Protected Optional Readonly _embeddings: EmbeddingFunction\<T>

Defined in

query.ts:37


_fastSearch

β€’ Private _fastSearch: boolean

Defined in

query.ts:36


_filter

β€’ Private Optional _filter: string

Defined in

query.ts:33


_limit

β€’ Private Optional _limit: number

Defined in

query.ts:29


_metricType

β€’ Private Optional _metricType: MetricType

Defined in

query.ts:34


_nprobes

β€’ Private _nprobes: number

Defined in

query.ts:31


_prefilter

β€’ Private _prefilter: boolean

Defined in

query.ts:35


_query

β€’ Private Optional Readonly _query: T

Defined in

query.ts:26


_queryVector

β€’ Private Optional _queryVector: number[]

Defined in

query.ts:28


_refineFactor

β€’ Private Optional _refineFactor: number

Defined in

query.ts:30


_select

β€’ Private Optional _select: string[]

Defined in

query.ts:32


_tbl

β€’ Private Optional Readonly _tbl: any

Defined in

query.ts:27


where

β€’ where: (value: string) => Query\<T>

Type declaration

β–Έ (value): Query\<T>

A filter statement to be applied to this query.

Parameters
Name Type Description
value string A filter in the same format used by a sql WHERE clause.
Returns

Query\<T>

Defined in

query.ts:90

Methods

execute

β–Έ execute\<T>(): Promise\<T[]>

Execute the query and return the results as an Array of Objects

Type parameters

Name Type
T Record\<string, unknown>

Returns

Promise\<T[]>

Defined in

query.ts:127


fastSearch

β–Έ fastSearch(value): Query\<T>

Skip searching un-indexed data. This can make search faster, but will miss any data that is not yet indexed.

Parameters

Name Type
value boolean

Returns

Query\<T>

Defined in

query.ts:119


filter

β–Έ filter(value): Query\<T>

A filter statement to be applied to this query.

Parameters

Name Type Description
value string A filter in the same format used by a sql WHERE clause.

Returns

Query\<T>

Defined in

query.ts:85


isElectron

β–Έ Private isElectron(): boolean

Returns

boolean

Defined in

query.ts:155


limit

β–Έ limit(value): Query\<T>

Sets the number of results that will be returned default value is 10

Parameters

Name Type Description
value number number of results

Returns

Query\<T>

Defined in

query.ts:58


metricType

β–Έ metricType(value): Query\<T>

The MetricType used for this Query.

Parameters

Name Type Description
value MetricType The metric to the.

Returns

Query\<T>

See

MetricType for the different options

Defined in

query.ts:105


nprobes

β–Έ nprobes(value): Query\<T>

The number of probes used. A higher number makes search more accurate but also slower.

Parameters

Name Type Description
value number The number of probes used.

Returns

Query\<T>

Defined in

query.ts:76


prefilter

β–Έ prefilter(value): Query\<T>

Parameters

Name Type
value boolean

Returns

Query\<T>

Defined in

query.ts:110


refineFactor

β–Έ refineFactor(value): Query\<T>

Refine the results by reading extra elements and re-ranking them in memory.

Parameters

Name Type Description
value number refine factor to use in this query.

Returns

Query\<T>

Defined in

query.ts:67


select

β–Έ select(value): Query\<T>

Return only the specified columns.

Parameters

Name Type Description
value string[] Only select the specified columns. If not specified, all columns will be returned.

Returns

Query\<T>

Defined in

query.ts:96