$request = array ( 'table_name' => $this->table, 'primary_key' => array ( // 主键 array('id', 123), array('PK1', 'abc') ), 'max_versions' => 1, 'column_filter' => array ( 'logical_operator' => LogicalOperatorConst::CONST_AND, // 对返回的数据进行筛选,只有当attr1为Hanzhou且attr2为3.14的时候才返回数据 'sub_filters' => array ( array ( 'column_name' => 'attr0', 'value' => 456, 'comparator' => ComparatorTypeConst::CONST_EQUAL ), array ( 'column_name' => 'attr3', 'value' => true, 'comparator' => ComparatorTypeConst::CONST_EQUAL ) ) ) ); $response = $this->client->getRow ($request);
$response = $this->client->search(array( 'table_name' => $this->table, 'index_name' => 'create_search_index', 'search_query' => array( 'offset' => 0, 'limit' => 10, 'get_total_count' => true, // 'collapse' => array( // 'field_name' => 'keyword' // ), //模糊查询 'query' => array( 'query_type' => QueryTypeConst::WILDCARD_QUERY, 'query' => array( 'field_name' => 'title', 'value' => '测试文章05*', // 'operator' => QueryOperatorConst::PBOR, // 'minimum_should_match' => 3 ) ), 'sort' => array( array( 'field_sort' => array( 'field_name' => 'id', 'order' => SortOrderConst::SORT_ORDER_ASC ) ), ) ), 'columns_to_get' => array( 'return_type' => ColumnReturnTypeConst::RETURN_SPECIFIED, 'return_names' => array('title','file') ) ));
$goods = GOODS::order('id asc')->limit(200)->select(); foreach ($goods as $value) { $list[] = array( // 第一行 'operation_type' => OperationTypeConst::CONST_PUT, //操作是PUT 'condition' => RowExistenceExpectationConst::CONST_IGNORE, 'primary_key' => array( array('article_id', Str::randString(32)), array('id',null, PrimaryKeyTypeConst::CONST_PK_AUTO_INCR) ), // 'update_of_attribute_columns' => array( // 'INCREMENT' => array( // 三种操作类型, PUT,DELETE,DELETE_ALL // array('id', 1), // 自增列 // ) // ), 'attribute_columns' => array( array('id', $value['id']), array('create_time', 'a binary string', ColumnTypeConst::CONST_BINARY, $timestamp), // BINARY类型, 同时增加timestamp字段 array('update_time', 'a binary string', ColumnTypeConst::CONST_BINARY, $timestamp), // BINARY类型, 同时增加timestamp字段 ), 'return_content' => array( 'return_type' => ReturnTypeConst::CONST_PK // 列自增需要主键返回需要设置return_type ) ); } $request = array( 'tables' => array( array( 'table_name' => $this->table, 'rows' => $list ) ) ); $response = $this->client->batchWriteRow($request);