Google Cloud Vector Search V1 Client - Class TextSearch (0.11.0)

Reference documentation and code samples for the Google Cloud Vector Search V1 Client class TextSearch.

Defines a text search operation.

Generated from protobuf message google.cloud.vectorsearch.v1.TextSearch

Namespace

Google \ Cloud \ VectorSearch \ V1

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ search_text string

Optional. The query text. Required when using the default text search mode.

↳ data_field_names string[]

Optional. The data field names to search. Required when using the default text search mode.

↳ output_fields OutputFields

Optional. The fields to return in the search results.

↳ top_k int

Optional. The number of results to return.

↳ filter Google\Protobuf\Struct

Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}}, represented as a google.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: $and or $or with a list of filters, or $not with one filter. Field operators and their values: $eq and $ne take a string, number or bool; $lt, $lte, $gt and $gte take a number; $in, $nin and $all take a list of strings; $exists takes a bool. Several keys in one object (implicit AND) and implicit equality ({"genre": "sci-fi"}) are rejected; use $and and $eq instead. Logical operators can be nested at most 2 levels deep, e.g. {"$and": [{"$or": [{"a": {"$eq": 1}}, {"b": {"$eq": 2}}]}]}. Deeper filters are rejected with INVALID_ARGUMENT.

↳ structured_query StructuredQuery

Optional. Structured query definition. When set, search_text and data_field_names must be left empty; otherwise the request will be rejected with an INVALID_ARGUMENT error. Conversely, when structured_query is unset, both search_text and data_field_names are required.

getSearchText

Optional. The query text. Required when using the default text search mode.

Returns
Type Description
string

setSearchText

Optional. The query text. Required when using the default text search mode.

Parameter
Name Description
var string
Returns
Type Description
$this

getDataFieldNames

Optional. The data field names to search. Required when using the default text search mode.

Returns
Type Description
Google\Protobuf\RepeatedField<string>

setDataFieldNames

Optional. The data field names to search. Required when using the default text search mode.

Parameter
Name Description
var string[]
Returns
Type Description
$this

getOutputFields

Optional. The fields to return in the search results.

Returns
Type Description
OutputFields|null

hasOutputFields

clearOutputFields

setOutputFields

Optional. The fields to return in the search results.

Parameter
Name Description
var OutputFields
Returns
Type Description
$this

getTopK

Optional. The number of results to return.

Returns
Type Description
int

hasTopK

clearTopK

setTopK

Optional. The number of results to return.

Parameter
Name Description
var int
Returns
Type Description
$this

getFilter

Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}}, represented as a google.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: $and or $or with a list of filters, or $not with one filter. Field operators and their values: $eq and $ne take a string, number or bool; $lt, $lte, $gt and $gte take a number; $in, $nin and $all take a list of strings; $exists takes a bool. Several keys in one object (implicit AND) and implicit equality ({"genre": "sci-fi"}) are rejected; use $and and $eq instead. Logical operators can be nested at most 2 levels deep, e.g. {"$and": [{"$or": [{"a": {"$eq": 1}}, {"b": {"$eq": 2}}]}]}. Deeper filters are rejected with INVALID_ARGUMENT.

Returns
Type Description
Google\Protobuf\Struct|null

hasFilter

clearFilter

setFilter

Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}}, represented as a google.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: $and or $or with a list of filters, or $not with one filter. Field operators and their values: $eq and $ne take a string, number or bool; $lt, $lte, $gt and $gte take a number; $in, $nin and $all take a list of strings; $exists takes a bool. Several keys in one object (implicit AND) and implicit equality ({"genre": "sci-fi"}) are rejected; use $and and $eq instead. Logical operators can be nested at most 2 levels deep, e.g. {"$and": [{"$or": [{"a": {"$eq": 1}}, {"b": {"$eq": 2}}]}]}. Deeper filters are rejected with INVALID_ARGUMENT.

Parameter
Name Description
var Google\Protobuf\Struct
Returns
Type Description
$this

getStructuredQuery

Optional. Structured query definition. When set, search_text and data_field_names must be left empty; otherwise the request will be rejected with an INVALID_ARGUMENT error. Conversely, when structured_query is unset, both search_text and data_field_names are required.

Returns
Type Description
StructuredQuery|null

hasStructuredQuery

clearStructuredQuery

setStructuredQuery

Optional. Structured query definition. When set, search_text and data_field_names must be left empty; otherwise the request will be rejected with an INVALID_ARGUMENT error. Conversely, when structured_query is unset, both search_text and data_field_names are required.

Parameter
Name Description
var StructuredQuery
Returns
Type Description
$this