您可以使用RangeQuery接口根据范围条件查询表中的数据。对于分词字符串类型(TEXT),只要分词后的词条中有词条满足范围条件即可。

/**
 * 查询表中Col_Long这一列大于3的数据,结果按照Col_Long这一列的值逆序排序。
 */
func RangeQuery(client *tablestore.TableStoreClient, tableName string, indexName string) {
    searchRequest := &tablestore.SearchRequest{}
    searchRequest.SetTableName(tableName)
    searchRequest.SetIndexName(indexName)
    searchQuery := search.NewSearchQuery()
    rangeQuery := &search.RangeQuery{} // 设置查询类型为RangeQuery
    rangeQuery.FieldName = "Col_Long" // 设置针对哪个字段
    rangeQuery.GT(3) // 设置该字段的范围条件,大于3
    searchQuery.SetQuery(rangeQuery)
    // 设置按照Col_Long这一列逆序排序
    searchQuery.SetSort(&search.Sort{
        []search.Sorter{
            &search.FieldSort{
                FieldName: "Col_Long",
                Order:     search.SortOrder_DESC.Enum(),
            },
        },
    })
    searchRequest.SetSearchQuery(searchQuery)
    searchRequest.SetColumnsToGet(&tablestore.ColumnsToGet{
        ReturnAll:true,
    })
    searchResponse, err := client.Search(searchRequest)
    if err != nil {
        fmt.Printf("%#v", err)
        return
    }
    fmt.Println("IsAllSuccess: ", searchResponse.IsAllSuccess) // 查看返回结果是否完整
    fmt.Println("RowCount: ", len(searchResponse.Rows))
    for _, row := range searchResponse.Rows {
        jsonBody, err := json.Marshal(row)
        if err != nil {
            panic(err)
        }
        fmt.Println("Row: ", string(jsonBody))
    }
}