protobuf格式的返回结果需反序列化成PBResult才能使用。PBResult.proto定义如下:
package isearch.common;
option cc_enable_arenas = true;
message PBAttrKVPair {
optional string key = 1;
repeated int64 int64Value = 2;
repeated double doubleValue = 3;
repeated bytes bytesValue = 4;
}
enum ValueType {
ATTRIBUTE_TYPE = 0;
VARIABLE_VALUE_TYPE = 1;
}
message PBInt64Attribute {
optional string key = 1;
optional ValueType type = 2;
repeated int64 int64Value = 3;
repeated uint32 offset = 4;
}
message PBDoubleAttribute {
optional string key = 1;
optional ValueType type = 2;
repeated double doubleValue = 3;
repeated uint32 offset = 4;
}
message PBBytesAttribute {
optional string key = 1;
optional ValueType type = 2;
repeated bytes bytesValue = 3;
repeated uint32 offset = 4;
}
message SortExprssionMeta {
optional bool sortFlag = 1;
optional string sortExprName = 2;
}
message PBSortValues {
optional uint32 dimensionCount = 1;
repeated double sortValues = 2;
repeated SortExprssionMeta sortExprMetas = 3;
}
message PBKVPair {
optional string key = 1;
optional bytes value = 2;
}
message PBResult
{
optional uint64 totalTime = 1;
optional PBHits hits = 2;
repeated PBAggregateResults aggResults = 3;
repeated PBErrorResult errorResults = 4;
optional bytes tracer = 5;
optional bool fromCache = 6;
optional PBMatchDocs matchDocs = 7;
repeated PBMetaMap metaMap = 8;
}
message PBMatchDocs
{
optional uint32 numMatchDocs = 1;
optional uint32 totalMatchDocs = 2;
repeated string clusterNames = 3;
repeated uint32 clusterIds = 4;
repeated uint32 hashids = 5;
repeated uint32 docids = 6;
repeated int32 fullIndexVersions = 7;
repeated int32 indexVersions = 8;
repeated uint64 pkHighers = 9;
repeated uint64 pkLowers = 10;
repeated uint32 searcherIps = 11;
repeated bytes tracers = 12;
repeated PBInt64Attribute int64AttrValues = 13;
repeated PBDoubleAttribute doubleAttrValues = 14;
repeated PBBytesAttribute bytesAttrValues = 15;
optional PBSortValues sortValues = 16;
}
message PBHits
{
optional uint32 numhits = 1;
optional uint32 totalHits = 2;
repeated PBHit hit = 3;
repeated PBMetaHitMap metaHitMap = 4;
optional double coveredPercent = 5;
repeated SortExprssionMeta sortExprMetas = 6;
}
message PBHit {
optional string clusterName = 1;
optional uint32 hashid = 2;
optional uint32 docid = 3;
optional int32 fullIndexVersion = 4;
optional int32 indexVersion = 5;
optional uint64 pkHigher = 6;
optional uint64 pkLower = 7;
repeated PBAttrKVPair attributes = 8;
repeated PBAttrKVPair variableValues = 9;
repeated PBKVPair summary = 10;
repeated PBKVPair property = 11;
repeated string sortValues = 12;
optional bytes tracer = 13;
optional uint32 searcherIp = 14;
optional string rawPk = 15;
optional bytes summaryBytes = 16;
}
message PBMetaHitMap
{
optional string metaHitKey = 1;
repeated PBKVPair metaHitValue = 2;
}
message PBAggregateResults
{
optional string aggregateKey = 1;
repeated PBAggregateValue aggregateValue = 2;
}
message PBAggregateValue
{
optional string groupValue = 1;
repeated PBKVPair funNameResultPair = 2;
}
message PBErrorResult
{
optional string partitionId = 1;
optional string hostName = 2;
optional uint32 errorCode = 3;
optional string errorDescription = 4;
}
message PBMetaMap
{
optional string metaKey = 1;
repeated PBKVPair metaValue = 2;
}
文档内容是否对您有帮助?