Reference documentation and code samples for the Cloud Datastore 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.datastore.v1.FindNearest
Namespace
Google \ Cloud \ Datastore \ V1Methods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
data |
array
Optional. Data for populating the Message object. |
↳ vector_property |
Google\Cloud\Datastore\V1\PropertyReference
Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned. |
↳ query_vector |
Google\Cloud\Datastore\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 100. |
↳ distance_result_property |
string
Optional. Optional name of the field to output the result of the vector distance calculation. Must conform to entity property limitations. |
↳ distance_threshold |
Google\Protobuf\DoubleValue
Optional. Option to specify a threshold for which no less similar documents will be returned. The behavior of the specified |
getVectorProperty
Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.
Returns | |
---|---|
Type | Description |
Google\Cloud\Datastore\V1\PropertyReference|null |
hasVectorProperty
clearVectorProperty
setVectorProperty
Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.
Parameter | |
---|---|
Name | Description |
var |
Google\Cloud\Datastore\V1\PropertyReference
|
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\Datastore\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\Datastore\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 100.
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 100.
Returns | |
---|---|
Type | Description |
int|null |
setLimit
Required. The number of nearest neighbors to return. Must be a positive integer of no more than 100.
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 100.
Parameter | |
---|---|
Name | Description |
var |
int|null
|
Returns | |
---|---|
Type | Description |
$this |
getDistanceResultProperty
Optional. Optional name of the field to output the result of the vector distance calculation. Must conform to entity property limitations.
Returns | |
---|---|
Type | Description |
string |
setDistanceResultProperty
Optional. Optional name of the field to output the result of the vector distance calculation. Must conform to entity property limitations.
Parameter | |
---|---|
Name | Description |
var |
string
|
Returns | |
---|---|
Type | Description |
$this |
getDistanceThreshold
Optional. Option to specify a threshold for which no less similar documents
will be returned. The behavior of the specified distance_measure
will
affect the meaning of the distance threshold. Since DOT_PRODUCT distances
increase when the vectors are more similar, the comparison is inverted.
For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold For DOT_PRODUCT: WHERE distance >= distance_threshold
Returns | |
---|---|
Type | Description |
Google\Protobuf\DoubleValue|null |
hasDistanceThreshold
clearDistanceThreshold
getDistanceThresholdValue
Returns the unboxed value from getDistanceThreshold()
Optional. Option to specify a threshold for which no less similar documents
will be returned. The behavior of the specified distance_measure
will
affect the meaning of the distance threshold. Since DOT_PRODUCT distances
increase when the vectors are more similar, the comparison is inverted.
For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
For DOT_PRODUCT: WHERE distance >= distance_threshold
Returns | |
---|---|
Type | Description |
float|null |
setDistanceThreshold
Optional. Option to specify a threshold for which no less similar documents
will be returned. The behavior of the specified distance_measure
will
affect the meaning of the distance threshold. Since DOT_PRODUCT distances
increase when the vectors are more similar, the comparison is inverted.
For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold For DOT_PRODUCT: WHERE distance >= distance_threshold
Parameter | |
---|---|
Name | Description |
var |
Google\Protobuf\DoubleValue
|
Returns | |
---|---|
Type | Description |
$this |
setDistanceThresholdValue
Sets the field by wrapping a primitive type in a Google\Protobuf\DoubleValue object.
Optional. Option to specify a threshold for which no less similar documents
will be returned. The behavior of the specified distance_measure
will
affect the meaning of the distance threshold. Since DOT_PRODUCT distances
increase when the vectors are more similar, the comparison is inverted.
For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
For DOT_PRODUCT: WHERE distance >= distance_threshold
Parameter | |
---|---|
Name | Description |
var |
float|null
|
Returns | |
---|---|
Type | Description |
$this |