Class: Query\<T>
A builder for nearest neighbor queries for LanceDB.
Type parameters
| Name | Type |
|---|---|
T |
number[] |
Table of contents
Constructors
Properties
- _embeddings
- _fastSearch
- _filter
- _limit
- _metricType
- _nprobes
- _prefilter
- _query
- _queryVector
- _refineFactor
- _select
- _tbl
- where
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
Properties
_embeddings
β’ Protected Optional Readonly _embeddings: EmbeddingFunction\<T>
Defined in
_fastSearch
β’ Private _fastSearch: boolean
Defined in
_filter
β’ Private Optional _filter: string
Defined in
_limit
β’ Private Optional _limit: number
Defined in
_metricType
β’ Private Optional _metricType: MetricType
Defined in
_nprobes
β’ Private _nprobes: number
Defined in
_prefilter
β’ Private _prefilter: boolean
Defined in
_query
β’ Private Optional Readonly _query: T
Defined in
_queryVector
β’ Private Optional _queryVector: number[]
Defined in
_refineFactor
β’ Private Optional _refineFactor: number
Defined in
_select
β’ Private Optional _select: string[]
Defined in
_tbl
β’ Private Optional Readonly _tbl: any
Defined in
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
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
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
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
isElectron
βΈ Private isElectron(): boolean
Returns
boolean
Defined in
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
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
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
prefilter
βΈ prefilter(value): Query\<T>
Parameters
| Name | Type |
|---|---|
value |
boolean |
Returns
Query\<T>
Defined in
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
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>