|
| 1 | +# Copyright 2019 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# NOTE: This file is auto generated by the elixir code generator program. |
| 16 | +# Do not edit this file manually. |
| 17 | + |
| 18 | +defmodule GoogleApi.Datastore.V1.Model.FindNearest do |
| 19 | + @moduledoc """ |
| 20 | + 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. |
| 21 | +
|
| 22 | + ## Attributes |
| 23 | +
|
| 24 | + * `distanceMeasure` (*type:* `String.t`, *default:* `nil`) - Required. The Distance Measure to use, required. |
| 25 | + * `distanceResultProperty` (*type:* `String.t`, *default:* `nil`) - Optional. Optional name of the field to output the result of the vector distance calculation. Must conform to entity property limitations. |
| 26 | + * `distanceThreshold` (*type:* `float()`, *default:* `nil`) - 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 |
| 27 | + * `limit` (*type:* `integer()`, *default:* `nil`) - Required. The number of nearest neighbors to return. Must be a positive integer of no more than 100. |
| 28 | + * `queryVector` (*type:* `GoogleApi.Datastore.V1.Model.Value.t`, *default:* `nil`) - Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions. |
| 29 | + * `vectorProperty` (*type:* `GoogleApi.Datastore.V1.Model.PropertyReference.t`, *default:* `nil`) - Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned. |
| 30 | + """ |
| 31 | + |
| 32 | + use GoogleApi.Gax.ModelBase |
| 33 | + |
| 34 | + @type t :: %__MODULE__{ |
| 35 | + :distanceMeasure => String.t() | nil, |
| 36 | + :distanceResultProperty => String.t() | nil, |
| 37 | + :distanceThreshold => float() | nil, |
| 38 | + :limit => integer() | nil, |
| 39 | + :queryVector => GoogleApi.Datastore.V1.Model.Value.t() | nil, |
| 40 | + :vectorProperty => GoogleApi.Datastore.V1.Model.PropertyReference.t() | nil |
| 41 | + } |
| 42 | + |
| 43 | + field(:distanceMeasure) |
| 44 | + field(:distanceResultProperty) |
| 45 | + field(:distanceThreshold) |
| 46 | + field(:limit) |
| 47 | + field(:queryVector, as: GoogleApi.Datastore.V1.Model.Value) |
| 48 | + field(:vectorProperty, as: GoogleApi.Datastore.V1.Model.PropertyReference) |
| 49 | +end |
| 50 | + |
| 51 | +defimpl Poison.Decoder, for: GoogleApi.Datastore.V1.Model.FindNearest do |
| 52 | + def decode(value, options) do |
| 53 | + GoogleApi.Datastore.V1.Model.FindNearest.decode(value, options) |
| 54 | + end |
| 55 | +end |
| 56 | + |
| 57 | +defimpl Poison.Encoder, for: GoogleApi.Datastore.V1.Model.FindNearest do |
| 58 | + def encode(value, options) do |
| 59 | + GoogleApi.Gax.ModelBase.encode(value, options) |
| 60 | + end |
| 61 | +end |
0 commit comments