Reference documentation and code samples for the Cloud Firestore V1 Client class FindNearest.
Nearest Neighbors search config. The ordering provided by FindNearest supersedes the order_by stage. If multiple documents have the same vector distance, the returned document order is not guaranteed to be stable between queries.
Generated from protobuf message google.firestore.v1.StructuredQuery.FindNearest
Namespace
Google \ Cloud \ Firestore \ V1 \ StructuredQueryMethods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
data |
array
Optional. Data for populating the Message object. |
↳ vector_field |
Google\Cloud\Firestore\V1\StructuredQuery\FieldReference
Required. An indexed vector field to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned. |
↳ query_vector |
Google\Cloud\Firestore\V1\Value
Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions. |
↳ distance_measure |
int
Required. The distance measure to use, required. |
↳ limit |
Google\Protobuf\Int32Value
Required. The number of nearest neighbors to return. Must be a positive integer of no more than 1000. |
getVectorField
Required. An indexed vector field to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Firestore\V1\StructuredQuery\FieldReference|null |
|
hasVectorField
clearVectorField
setVectorField
Required. An indexed vector field to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.
| Parameter | |
|---|---|
| Name | Description |
var |
Google\Cloud\Firestore\V1\StructuredQuery\FieldReference
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getQueryVector
Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Firestore\V1\Value|null |
|
hasQueryVector
clearQueryVector
setQueryVector
Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.
| Parameter | |
|---|---|
| Name | Description |
var |
Google\Cloud\Firestore\V1\Value
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getDistanceMeasure
Required. The distance measure to use, required.
| Returns | |
|---|---|
| Type | Description |
int |
|
setDistanceMeasure
Required. The distance measure to use, required.
| Parameter | |
|---|---|
| Name | Description |
var |
int
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getLimit
Required. The number of nearest neighbors to return. Must be a positive integer of no more than 1000.
| Returns | |
|---|---|
| Type | Description |
Google\Protobuf\Int32Value|null |
|
hasLimit
clearLimit
getLimitValue
Returns the unboxed value from getLimit()
Required. The number of nearest neighbors to return. Must be a positive integer of no more than 1000.
| Returns | |
|---|---|
| Type | Description |
int|null |
|
setLimit
Required. The number of nearest neighbors to return. Must be a positive integer of no more than 1000.
| Parameter | |
|---|---|
| Name | Description |
var |
Google\Protobuf\Int32Value
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
setLimitValue
Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object.
Required. The number of nearest neighbors to return. Must be a positive integer of no more than 1000.
| Parameter | |
|---|---|
| Name | Description |
var |
int|null
|
| Returns | |
|---|---|
| Type | Description |
$this |
|