All Products
Search
Document Center

Tablestore:TermQuery

Last Updated:May 09, 2024

TermQuery specifies the configurations of a term query. You can use the term query feature to query data that exactly matches the specified value of a field. A term query is similar to queries based on string match conditions. If the field used to match the prefix is a TEXT field, the field values are tokenized. A row meets the query conditions when at least one token contains the specified prefix.

Data structure

message TermQuery {
    optional string field_name = 1;
    optional bytes term = 2;
    optional float weight = 3;
}

Parameter

Type

Required

Description

field_name

string

Yes

The name of the attribute column.

term

bytes

Yes

The keyword that is used to match the field values when you perform a term query. The value must be encoded by using PlainBuffer. For more information, see PlainBuffer.

This word is not tokenized but used as an entire word.

If the field used to match the prefix is a TEXT field, the field values are tokenized. A row meets the query conditions when at least one token contains the specified prefix. For example, if the value of a column of the TEXT type in a row is tablestore is cool, the value can be tokenized into tablestore, is, and cool. The row meets the query conditions when you specify tablestore, is, or cool as the keyword to match the values of the column.

weight

float

No

The weight configurations of the query condition.