All Products
Search
Document Center

Tablestore:MatchQuery

Last Updated:May 09, 2024

MatchQuery specifies the configurations of a match query. You can use match query to query data in a table based on approximate matches.

Data structure

message MatchQuery {
    optional string field_name = 1;
    optional string text = 2;
    optional int32 minimum_should_match = 3;
    optional QueryOperator operator = 4;
    optional float weight = 5;
}

Parameter

Type

Required

Description

field_name

string

Yes

The name of the column that you want to query.

The column can be of the TEXT type.

text

string

Yes

The keyword that is used to match the value of the column when you perform a match query.

If the column that you want to query is of the TEXT type, the keyword is tokenized into multiple tokens based on the analyzer type that you specify when you create the search index. By default, single-word tokenization is performed if you do not specify the analyzer type when you create the search index.

For example, if the column that you want to query is of the TEXT type and the analyzer type is single-word tokenization, when you use "this is" as the keyword, query results such as "..., this is tablestore", "is this tablestore", "tablestore is cool", "this", and "is“ are returned.

minimum_should_match

int32

No

The minimum number of matched tokens contained in a column value. This parameter must be used together with the OR logical operator.

A row is returned only when the value of the field_name column in the row contains at least the minimum number of matched tokens.

operator

QueryOperator

No

The query operator. You can specify the AND or OR operator. By default, OR is used as the logical operator, which indicates that a row meets the query conditions when the column value contains at least the minimum number of tokens.

weight

float

No

The weight configurations of the query condition.