Reference documentation and code samples for the Vector Search V1 API class Google::Cloud::VectorSearch::V1::SemanticSearch.
Defines a semantic search operation.
Inherits
- Object
Extended By
- Google::Protobuf::MessageExts::ClassMethods
Includes
- Google::Protobuf::MessageExts
Methods
#filter
def filter() -> ::Google::Protobuf::Struct-
(::Google::Protobuf::Struct) — Optional. A JSON filter expression, e.g.
{"genre": {"$eq": "sci-fi"}}, represented as agoogle.protobuf.Struct.An empty filter (
{}) matches all data objects. Otherwise, each JSON object in the filter must have exactly one key: either a field name mapped to one operator ({"price": {"$lt": 100}}), or a logical operator:$andor$orwith a list of filters, or$notwith one filter. Field operators and their values:$eqand$netake a string, number or bool;$lt,$lte,$gtand$gtetake a number;$in,$ninand$alltake a list of strings;$existstakes a bool. Several keys in one object (implicit AND) and implicit equality ({"genre": "sci-fi"}) are rejected; use$andand$eqinstead.Logical operators can be nested at most 2 levels deep, e.g.
{"$and": [{"$or": [{"a": {"$eq": 1}}, {"b": {"$eq": 2}}]}]}. Deeper filters are rejected withINVALID_ARGUMENT.Which filters are accepted depends on how the search is served. If it is served by an approximate nearest neighbor (ANN) index (by default when a ready index exists on
search_field, or when one is selected viasearch_hint.index_hint), every filtered field must be listed inIndex.filter_fieldsat index creation,$orand$allare accepted only at the top level of the filter, and$notand$existsare not supported. Not every unsupported filter is rejected: most produceINVALID_ARGUMENT, but some are silently ignored, so do not rely on the error. If no ready index exists onsearch_field, or ifsearch_hint.knn_hintis set, the search is served by K-Nearest Neighbor (KNN) search, which has none of these filter restrictions.
#filter=
def filter=(value) -> ::Google::Protobuf::Struct-
value (::Google::Protobuf::Struct) — Optional. A JSON filter expression, e.g.
{"genre": {"$eq": "sci-fi"}}, represented as agoogle.protobuf.Struct.An empty filter (
{}) matches all data objects. Otherwise, each JSON object in the filter must have exactly one key: either a field name mapped to one operator ({"price": {"$lt": 100}}), or a logical operator:$andor$orwith a list of filters, or$notwith one filter. Field operators and their values:$eqand$netake a string, number or bool;$lt,$lte,$gtand$gtetake a number;$in,$ninand$alltake a list of strings;$existstakes a bool. Several keys in one object (implicit AND) and implicit equality ({"genre": "sci-fi"}) are rejected; use$andand$eqinstead.Logical operators can be nested at most 2 levels deep, e.g.
{"$and": [{"$or": [{"a": {"$eq": 1}}, {"b": {"$eq": 2}}]}]}. Deeper filters are rejected withINVALID_ARGUMENT.Which filters are accepted depends on how the search is served. If it is served by an approximate nearest neighbor (ANN) index (by default when a ready index exists on
search_field, or when one is selected viasearch_hint.index_hint), every filtered field must be listed inIndex.filter_fieldsat index creation,$orand$allare accepted only at the top level of the filter, and$notand$existsare not supported. Not every unsupported filter is rejected: most produceINVALID_ARGUMENT, but some are silently ignored, so do not rely on the error. If no ready index exists onsearch_field, or ifsearch_hint.knn_hintis set, the search is served by K-Nearest Neighbor (KNN) search, which has none of these filter restrictions.
-
(::Google::Protobuf::Struct) — Optional. A JSON filter expression, e.g.
{"genre": {"$eq": "sci-fi"}}, represented as agoogle.protobuf.Struct.An empty filter (
{}) matches all data objects. Otherwise, each JSON object in the filter must have exactly one key: either a field name mapped to one operator ({"price": {"$lt": 100}}), or a logical operator:$andor$orwith a list of filters, or$notwith one filter. Field operators and their values:$eqand$netake a string, number or bool;$lt,$lte,$gtand$gtetake a number;$in,$ninand$alltake a list of strings;$existstakes a bool. Several keys in one object (implicit AND) and implicit equality ({"genre": "sci-fi"}) are rejected; use$andand$eqinstead.Logical operators can be nested at most 2 levels deep, e.g.
{"$and": [{"$or": [{"a": {"$eq": 1}}, {"b": {"$eq": 2}}]}]}. Deeper filters are rejected withINVALID_ARGUMENT.Which filters are accepted depends on how the search is served. If it is served by an approximate nearest neighbor (ANN) index (by default when a ready index exists on
search_field, or when one is selected viasearch_hint.index_hint), every filtered field must be listed inIndex.filter_fieldsat index creation,$orand$allare accepted only at the top level of the filter, and$notand$existsare not supported. Not every unsupported filter is rejected: most produceINVALID_ARGUMENT, but some are silently ignored, so do not rely on the error. If no ready index exists onsearch_field, or ifsearch_hint.knn_hintis set, the search is served by K-Nearest Neighbor (KNN) search, which has none of these filter restrictions.
#output_fields
def output_fields() -> ::Google::Cloud::VectorSearch::V1::OutputFields- (::Google::Cloud::VectorSearch::V1::OutputFields) — Optional. The fields to return in the search results.
#output_fields=
def output_fields=(value) -> ::Google::Cloud::VectorSearch::V1::OutputFields- value (::Google::Cloud::VectorSearch::V1::OutputFields) — Optional. The fields to return in the search results.
- (::Google::Cloud::VectorSearch::V1::OutputFields) — Optional. The fields to return in the search results.
#search_field
def search_field() -> ::String- (::String) — Required. The vector field to search.
#search_field=
def search_field=(value) -> ::String- value (::String) — Required. The vector field to search.
- (::String) — Required. The vector field to search.
#search_hint
def search_hint() -> ::Google::Cloud::VectorSearch::V1::SearchHint- (::Google::Cloud::VectorSearch::V1::SearchHint) — Optional. Sets the search hint. If no strategy is specified, the service will use an index if one is available, and fall back to KNN search otherwise.
#search_hint=
def search_hint=(value) -> ::Google::Cloud::VectorSearch::V1::SearchHint- value (::Google::Cloud::VectorSearch::V1::SearchHint) — Optional. Sets the search hint. If no strategy is specified, the service will use an index if one is available, and fall back to KNN search otherwise.
- (::Google::Cloud::VectorSearch::V1::SearchHint) — Optional. Sets the search hint. If no strategy is specified, the service will use an index if one is available, and fall back to KNN search otherwise.
#search_text
def search_text() -> ::String-
(::String) — Optional. The query text, which is used to generate an embedding according
to the embedding model specified in the collection config.
Required when using the text search mode.
#search_text=
def search_text=(value) -> ::String-
value (::String) — Optional. The query text, which is used to generate an embedding according
to the embedding model specified in the collection config.
Required when using the text search mode.
-
(::String) — Optional. The query text, which is used to generate an embedding according
to the embedding model specified in the collection config.
Required when using the text search mode.
#task_type
def task_type() -> ::Google::Cloud::VectorSearch::V1::EmbeddingTaskType- (::Google::Cloud::VectorSearch::V1::EmbeddingTaskType) — Optional. The task type of the query embedding. Must be specified for text-only embedding models, see https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/embeddings/task-types Not needed for multi modal embedding models, see https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/embeddings/get-multimodal-embeddings#specify-task-instructions
#task_type=
def task_type=(value) -> ::Google::Cloud::VectorSearch::V1::EmbeddingTaskType- value (::Google::Cloud::VectorSearch::V1::EmbeddingTaskType) — Optional. The task type of the query embedding. Must be specified for text-only embedding models, see https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/embeddings/task-types Not needed for multi modal embedding models, see https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/embeddings/get-multimodal-embeddings#specify-task-instructions
- (::Google::Cloud::VectorSearch::V1::EmbeddingTaskType) — Optional. The task type of the query embedding. Must be specified for text-only embedding models, see https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/embeddings/task-types Not needed for multi modal embedding models, see https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/embeddings/get-multimodal-embeddings#specify-task-instructions
#top_k
def top_k() -> ::Integer- (::Integer) — Optional. The number of data objects to return.
#top_k=
def top_k=(value) -> ::Integer- value (::Integer) — Optional. The number of data objects to return.
- (::Integer) — Optional. The number of data objects to return.