Merge pull request #13 from lbryio/update-for-leveldb-hub
update trending fields for the leveldb hub
This commit is contained in:
commit
adb5f189d7
5 changed files with 133 additions and 192 deletions
|
@ -73,10 +73,7 @@ message SearchRequest {
|
|||
BoolValue is_signature_valid = 36;
|
||||
RangeField effective_amount = 37;
|
||||
RangeField support_amount = 38;
|
||||
RangeField trending_group = 39;
|
||||
RangeField trending_mixed = 40;
|
||||
RangeField trending_local = 41;
|
||||
RangeField trending_global = 42;
|
||||
RangeField trending_score = 39;
|
||||
string tx_id = 43;
|
||||
UInt32Value tx_nout = 44;
|
||||
string signature = 45;
|
||||
|
|
|
@ -35,13 +35,9 @@ message ClaimMeta {
|
|||
uint32 expiration_height = 9;
|
||||
uint32 claims_in_channel = 10;
|
||||
uint32 reposted = 11;
|
||||
|
||||
uint64 effective_amount = 20;
|
||||
uint64 support_amount = 21;
|
||||
uint32 trending_group = 22;
|
||||
float trending_mixed = 23;
|
||||
float trending_local = 24;
|
||||
float trending_global = 25;
|
||||
double trending_score = 22;
|
||||
}
|
||||
|
||||
message Error {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.17.3
|
||||
// protoc v3.15.8
|
||||
// source: hub.proto
|
||||
|
||||
package pb
|
||||
|
@ -322,10 +322,7 @@ type SearchRequest struct {
|
|||
IsSignatureValid *BoolValue `protobuf:"bytes,36,opt,name=is_signature_valid,json=isSignatureValid,proto3" json:"is_signature_valid"`
|
||||
EffectiveAmount *RangeField `protobuf:"bytes,37,opt,name=effective_amount,json=effectiveAmount,proto3" json:"effective_amount"`
|
||||
SupportAmount *RangeField `protobuf:"bytes,38,opt,name=support_amount,json=supportAmount,proto3" json:"support_amount"`
|
||||
TrendingGroup *RangeField `protobuf:"bytes,39,opt,name=trending_group,json=trendingGroup,proto3" json:"trending_group"`
|
||||
TrendingMixed *RangeField `protobuf:"bytes,40,opt,name=trending_mixed,json=trendingMixed,proto3" json:"trending_mixed"`
|
||||
TrendingLocal *RangeField `protobuf:"bytes,41,opt,name=trending_local,json=trendingLocal,proto3" json:"trending_local"`
|
||||
TrendingGlobal *RangeField `protobuf:"bytes,42,opt,name=trending_global,json=trendingGlobal,proto3" json:"trending_global"`
|
||||
TrendingScore *RangeField `protobuf:"bytes,39,opt,name=trending_score,json=trendingScore,proto3" json:"trending_score"`
|
||||
TxId string `protobuf:"bytes,43,opt,name=tx_id,json=txId,proto3" json:"tx_id"`
|
||||
TxNout *UInt32Value `protobuf:"bytes,44,opt,name=tx_nout,json=txNout,proto3" json:"tx_nout"`
|
||||
Signature string `protobuf:"bytes,45,opt,name=signature,proto3" json:"signature"`
|
||||
|
@ -642,30 +639,9 @@ func (x *SearchRequest) GetSupportAmount() *RangeField {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *SearchRequest) GetTrendingGroup() *RangeField {
|
||||
func (x *SearchRequest) GetTrendingScore() *RangeField {
|
||||
if x != nil {
|
||||
return x.TrendingGroup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SearchRequest) GetTrendingMixed() *RangeField {
|
||||
if x != nil {
|
||||
return x.TrendingMixed
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SearchRequest) GetTrendingLocal() *RangeField {
|
||||
if x != nil {
|
||||
return x.TrendingLocal
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SearchRequest) GetTrendingGlobal() *RangeField {
|
||||
if x != nil {
|
||||
return x.TrendingGlobal
|
||||
return x.TrendingScore
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -802,7 +778,7 @@ var file_hub_proto_rawDesc = []byte{
|
|||
0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x2e, 0x0a,
|
||||
0x02, 0x4f, 0x70, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x51, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4c,
|
||||
0x54, 0x45, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x54, 0x45, 0x10, 0x02, 0x12, 0x06, 0x0a,
|
||||
0x02, 0x4c, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x04, 0x22, 0x87, 0x13,
|
||||
0x02, 0x4c, 0x54, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x54, 0x10, 0x04, 0x22, 0xe0, 0x11,
|
||||
0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||
0x2e, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x69, 0x62, 0x6c,
|
||||
|
@ -905,63 +881,53 @@ var file_hub_proto_rawDesc = []byte{
|
|||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46,
|
||||
0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x6d, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x12, 0x35, 0x0a, 0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f,
|
||||
0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x27, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62,
|
||||
0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x27, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x74, 0x72, 0x65,
|
||||
0x6e, 0x64, 0x69, 0x6e, 0x67, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x35, 0x0a, 0x0e, 0x74, 0x72,
|
||||
0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x18, 0x28, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x52, 0x0d, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4d, 0x69, 0x78, 0x65,
|
||||
0x64, 0x12, 0x35, 0x0a, 0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x6f,
|
||||
0x63, 0x61, 0x6c, 0x18, 0x29, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52,
|
||||
0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x0d, 0x74, 0x72, 0x65, 0x6e, 0x64,
|
||||
0x69, 0x6e, 0x67, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x12, 0x37, 0x0a, 0x0f, 0x74, 0x72, 0x65, 0x6e,
|
||||
0x64, 0x69, 0x6e, 0x67, 0x5f, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x18, 0x2a, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x65, 0x6c,
|
||||
0x64, 0x52, 0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x47, 0x6c, 0x6f, 0x62, 0x61,
|
||||
0x6c, 0x12, 0x13, 0x0a, 0x05, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x2b, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x74, 0x78, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x6e, 0x6f, 0x75,
|
||||
0x74, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x49, 0x6e,
|
||||
0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x74, 0x78, 0x4e, 0x6f, 0x75, 0x74,
|
||||
0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x2d, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29,
|
||||
0x0a, 0x10, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x64, 0x69, 0x67, 0x65,
|
||||
0x73, 0x74, 0x18, 0x2e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74,
|
||||
0x75, 0x72, 0x65, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x70, 0x75, 0x62,
|
||||
0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x2f, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x79,
|
||||
0x74, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65,
|
||||
0x79, 0x5f, 0x69, 0x64, 0x18, 0x30, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c,
|
||||
0x69, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x6e, 0x79, 0x5f, 0x74,
|
||||
0x61, 0x67, 0x73, 0x18, 0x31, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x6e, 0x79, 0x54, 0x61,
|
||||
0x67, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x6c, 0x6c, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x32,
|
||||
0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x6c, 0x6c, 0x54, 0x61, 0x67, 0x73, 0x12, 0x19, 0x0a,
|
||||
0x08, 0x6e, 0x6f, 0x74, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x33, 0x20, 0x03, 0x28, 0x09, 0x52,
|
||||
0x07, 0x6e, 0x6f, 0x74, 0x54, 0x61, 0x67, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x68, 0x61, 0x73, 0x5f,
|
||||
0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72,
|
||||
0x65, 0x18, 0x34, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x68, 0x61, 0x73, 0x43, 0x68, 0x61, 0x6e,
|
||||
0x6e, 0x65, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x2c, 0x0a, 0x0a,
|
||||
0x68, 0x61, 0x73, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x35, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52,
|
||||
0x09, 0x68, 0x61, 0x73, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x6c, 0x69,
|
||||
0x6d, 0x69, 0x74, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x63,
|
||||
0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x36, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x6c, 0x69,
|
||||
0x6d, 0x69, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x50, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e,
|
||||
0x6e, 0x65, 0x6c, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6e, 0x79, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75,
|
||||
0x61, 0x67, 0x65, 0x73, 0x18, 0x37, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6e, 0x79, 0x4c,
|
||||
0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x5f,
|
||||
0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x18, 0x38, 0x20, 0x03, 0x28, 0x09, 0x52,
|
||||
0x0c, 0x61, 0x6c, 0x6c, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x12, 0x2b, 0x0a,
|
||||
0x11, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74,
|
||||
0x65, 0x73, 0x18, 0x39, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65,
|
||||
0x44, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f,
|
||||
0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x18, 0x3a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e,
|
||||
0x6f, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x32, 0x31, 0x0a, 0x03, 0x48, 0x75, 0x62, 0x12, 0x2a,
|
||||
0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65,
|
||||
0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0b, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x22, 0x00, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69,
|
||||
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x62, 0x72, 0x79, 0x69, 0x6f, 0x2f,
|
||||
0x68, 0x75, 0x62, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x67, 0x6f, 0x2f,
|
||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x6e, 0x64, 0x69, 0x6e, 0x67, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x13, 0x0a, 0x05, 0x74, 0x78,
|
||||
0x5f, 0x69, 0x64, 0x18, 0x2b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x78, 0x49, 0x64, 0x12,
|
||||
0x28, 0x0a, 0x07, 0x74, 0x78, 0x5f, 0x6e, 0x6f, 0x75, 0x74, 0x18, 0x2c, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x52, 0x06, 0x74, 0x78, 0x4e, 0x6f, 0x75, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67,
|
||||
0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69,
|
||||
0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x73, 0x69, 0x67, 0x6e, 0x61,
|
||||
0x74, 0x75, 0x72, 0x65, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x2e, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x44, 0x69, 0x67, 0x65,
|
||||
0x73, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79,
|
||||
0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x2f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x75,
|
||||
0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0d,
|
||||
0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x30, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64,
|
||||
0x12, 0x19, 0x0a, 0x08, 0x61, 0x6e, 0x79, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x31, 0x20, 0x03,
|
||||
0x28, 0x09, 0x52, 0x07, 0x61, 0x6e, 0x79, 0x54, 0x61, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x61,
|
||||
0x6c, 0x6c, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x32, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61,
|
||||
0x6c, 0x6c, 0x54, 0x61, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x5f, 0x74, 0x61,
|
||||
0x67, 0x73, 0x18, 0x33, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x6f, 0x74, 0x54, 0x61, 0x67,
|
||||
0x73, 0x12, 0x32, 0x0a, 0x15, 0x68, 0x61, 0x73, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c,
|
||||
0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x34, 0x20, 0x01, 0x28, 0x08,
|
||||
0x52, 0x13, 0x68, 0x61, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x69, 0x67, 0x6e,
|
||||
0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x2c, 0x0a, 0x0a, 0x68, 0x61, 0x73, 0x5f, 0x73, 0x6f, 0x75,
|
||||
0x72, 0x63, 0x65, 0x18, 0x35, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x42,
|
||||
0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, 0x68, 0x61, 0x73, 0x53, 0x6f, 0x75,
|
||||
0x72, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x63, 0x6c, 0x61,
|
||||
0x69, 0x6d, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18,
|
||||
0x36, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6c, 0x61, 0x69,
|
||||
0x6d, 0x73, 0x50, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x23, 0x0a, 0x0d,
|
||||
0x61, 0x6e, 0x79, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x18, 0x37, 0x20,
|
||||
0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6e, 0x79, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65,
|
||||
0x73, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67,
|
||||
0x65, 0x73, 0x18, 0x38, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x4c, 0x61, 0x6e,
|
||||
0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65,
|
||||
0x5f, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x18, 0x39, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x10, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61,
|
||||
0x74, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73,
|
||||
0x18, 0x3a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e, 0x6f, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x73,
|
||||
0x32, 0x31, 0x0a, 0x03, 0x48, 0x75, 0x62, 0x12, 0x2a, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63,
|
||||
0x68, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74,
|
||||
0x73, 0x22, 0x00, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x2f, 0x6c, 0x62, 0x72, 0x79, 0x69, 0x6f, 0x2f, 0x68, 0x75, 0x62, 0x2f, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -1008,19 +974,16 @@ var file_hub_proto_depIdxs = []int32{
|
|||
2, // 17: pb.SearchRequest.is_signature_valid:type_name -> pb.BoolValue
|
||||
4, // 18: pb.SearchRequest.effective_amount:type_name -> pb.RangeField
|
||||
4, // 19: pb.SearchRequest.support_amount:type_name -> pb.RangeField
|
||||
4, // 20: pb.SearchRequest.trending_group:type_name -> pb.RangeField
|
||||
4, // 21: pb.SearchRequest.trending_mixed:type_name -> pb.RangeField
|
||||
4, // 22: pb.SearchRequest.trending_local:type_name -> pb.RangeField
|
||||
4, // 23: pb.SearchRequest.trending_global:type_name -> pb.RangeField
|
||||
3, // 24: pb.SearchRequest.tx_nout:type_name -> pb.UInt32Value
|
||||
2, // 25: pb.SearchRequest.has_source:type_name -> pb.BoolValue
|
||||
5, // 26: pb.Hub.Search:input_type -> pb.SearchRequest
|
||||
6, // 27: pb.Hub.Search:output_type -> pb.Outputs
|
||||
27, // [27:28] is the sub-list for method output_type
|
||||
26, // [26:27] is the sub-list for method input_type
|
||||
26, // [26:26] is the sub-list for extension type_name
|
||||
26, // [26:26] is the sub-list for extension extendee
|
||||
0, // [0:26] is the sub-list for field type_name
|
||||
4, // 20: pb.SearchRequest.trending_score:type_name -> pb.RangeField
|
||||
3, // 21: pb.SearchRequest.tx_nout:type_name -> pb.UInt32Value
|
||||
2, // 22: pb.SearchRequest.has_source:type_name -> pb.BoolValue
|
||||
5, // 23: pb.Hub.Search:input_type -> pb.SearchRequest
|
||||
6, // 24: pb.Hub.Search:output_type -> pb.Outputs
|
||||
24, // [24:25] is the sub-list for method output_type
|
||||
23, // [23:24] is the sub-list for method input_type
|
||||
23, // [23:23] is the sub-list for extension type_name
|
||||
23, // [23:23] is the sub-list for extension extendee
|
||||
0, // [0:23] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_hub_proto_init() }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.17.3
|
||||
// protoc v3.15.8
|
||||
// source: result.proto
|
||||
|
||||
package pb
|
||||
|
@ -281,10 +281,7 @@ type ClaimMeta struct {
|
|||
Reposted uint32 `protobuf:"varint,11,opt,name=reposted,proto3" json:"reposted"`
|
||||
EffectiveAmount uint64 `protobuf:"varint,20,opt,name=effective_amount,json=effectiveAmount,proto3" json:"effective_amount"`
|
||||
SupportAmount uint64 `protobuf:"varint,21,opt,name=support_amount,json=supportAmount,proto3" json:"support_amount"`
|
||||
TrendingGroup uint32 `protobuf:"varint,22,opt,name=trending_group,json=trendingGroup,proto3" json:"trending_group"`
|
||||
TrendingMixed float32 `protobuf:"fixed32,23,opt,name=trending_mixed,json=trendingMixed,proto3" json:"trending_mixed"`
|
||||
TrendingLocal float32 `protobuf:"fixed32,24,opt,name=trending_local,json=trendingLocal,proto3" json:"trending_local"`
|
||||
TrendingGlobal float32 `protobuf:"fixed32,25,opt,name=trending_global,json=trendingGlobal,proto3" json:"trending_global"`
|
||||
TrendingScore float64 `protobuf:"fixed64,22,opt,name=trending_score,json=trendingScore,proto3" json:"trending_score"`
|
||||
}
|
||||
|
||||
func (x *ClaimMeta) Reset() {
|
||||
|
@ -410,30 +407,9 @@ func (x *ClaimMeta) GetSupportAmount() uint64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (x *ClaimMeta) GetTrendingGroup() uint32 {
|
||||
func (x *ClaimMeta) GetTrendingScore() float64 {
|
||||
if x != nil {
|
||||
return x.TrendingGroup
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ClaimMeta) GetTrendingMixed() float32 {
|
||||
if x != nil {
|
||||
return x.TrendingMixed
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ClaimMeta) GetTrendingLocal() float32 {
|
||||
if x != nil {
|
||||
return x.TrendingLocal
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ClaimMeta) GetTrendingGlobal() float32 {
|
||||
if x != nil {
|
||||
return x.TrendingGlobal
|
||||
return x.TrendingScore
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
@ -583,7 +559,7 @@ var file_result_proto_rawDesc = []byte{
|
|||
0x61, 0x48, 0x00, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x21, 0x0a, 0x05, 0x65, 0x72,
|
||||
0x72, 0x6f, 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45,
|
||||
0x72, 0x72, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x06, 0x0a,
|
||||
0x04, 0x6d, 0x65, 0x74, 0x61, 0x22, 0xa3, 0x05, 0x0a, 0x09, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d,
|
||||
0x04, 0x6d, 0x65, 0x74, 0x61, 0x22, 0xac, 0x04, 0x0a, 0x09, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d,
|
||||
0x65, 0x74, 0x61, 0x12, 0x24, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74,
|
||||
0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x22, 0x0a, 0x06, 0x72, 0x65, 0x70,
|
||||
|
@ -616,34 +592,27 @@ var file_result_proto_rawDesc = []byte{
|
|||
0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72,
|
||||
0x74, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x15, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d,
|
||||
0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a,
|
||||
0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18,
|
||||
0x16, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x47,
|
||||
0x72, 0x6f, 0x75, 0x70, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67,
|
||||
0x5f, 0x6d, 0x69, 0x78, 0x65, 0x64, 0x18, 0x17, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0d, 0x74, 0x72,
|
||||
0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x74,
|
||||
0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x18, 0x18, 0x20,
|
||||
0x01, 0x28, 0x02, 0x52, 0x0d, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4c, 0x6f, 0x63,
|
||||
0x61, 0x6c, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x67,
|
||||
0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x18, 0x19, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0e, 0x74, 0x72, 0x65,
|
||||
0x6e, 0x64, 0x69, 0x6e, 0x67, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x22, 0xa9, 0x01, 0x0a, 0x05,
|
||||
0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x22, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x43,
|
||||
0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x25, 0x0a,
|
||||
0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b,
|
||||
0x2e, 0x70, 0x62, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x52, 0x07, 0x62, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x65, 0x64, 0x22, 0x41, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c,
|
||||
0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x10, 0x00, 0x12, 0x0d,
|
||||
0x0a, 0x09, 0x4e, 0x4f, 0x54, 0x5f, 0x46, 0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a,
|
||||
0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x42, 0x4c,
|
||||
0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x03, 0x22, 0x45, 0x0a, 0x07, 0x42, 0x6c, 0x6f, 0x63, 0x6b,
|
||||
0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e,
|
||||
0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x4f,
|
||||
0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x42, 0x26,
|
||||
0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x62, 0x72,
|
||||
0x79, 0x69, 0x6f, 0x2f, 0x68, 0x75, 0x62, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18,
|
||||
0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0d, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x53,
|
||||
0x63, 0x6f, 0x72, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x22,
|
||||
0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x70,
|
||||
0x62, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f,
|
||||
0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x25, 0x0a, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65,
|
||||
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x65, 0x64, 0x52, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x22, 0x41, 0x0a,
|
||||
0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e,
|
||||
0x5f, 0x43, 0x4f, 0x44, 0x45, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x4f, 0x54, 0x5f, 0x46,
|
||||
0x4f, 0x55, 0x4e, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49,
|
||||
0x44, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x03,
|
||||
0x22, 0x45, 0x0a, 0x07, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x12, 0x24, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x07,
|
||||
0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75,
|
||||
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x62, 0x72, 0x79, 0x69, 0x6f, 0x2f, 0x68, 0x75, 0x62,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x62, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
|
@ -2,18 +2,17 @@ package server
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"math"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
//"github.com/lbryio/hub/schema"
|
||||
|
||||
"github.com/btcsuite/btcutil/base58"
|
||||
pb "github.com/lbryio/hub/protobuf/go"
|
||||
"github.com/lbryio/lbry.go/v2/extras/util"
|
||||
"github.com/olivere/elastic/v7"
|
||||
|
@ -41,14 +40,11 @@ type record struct {
|
|||
ActivationHeight uint32 `json:"activation_height"`
|
||||
ExpirationHeight uint32 `json:"expiration_height"`
|
||||
ClaimsInChannel uint32 `json:"claims_in_channel"`
|
||||
Reposted uint32 `json:"repost_count"`
|
||||
RepostCount uint32 `json:"repost_count"`
|
||||
EffectiveAmount uint64 `json:"effective_amount"`
|
||||
SupportAmount uint64 `json:"support_amount"`
|
||||
TrendingGroup uint32 `json:"trending_group"`
|
||||
TrendingMixed float32 `json:"trending_mixed"`
|
||||
TrendingLocal float32 `json:"trending_local"`
|
||||
TrendingGlobal float32 `json:"trending_global"`
|
||||
Name string `json:"name"`
|
||||
TrendingScore float64 `json:"TrendingScore"`
|
||||
ClaimName string `json:"claim_name"`
|
||||
}
|
||||
|
||||
type orderField struct {
|
||||
|
@ -94,7 +90,6 @@ func AddRangeField(q *elastic.BoolQuery, rq *pb.RangeField, name string) *elasti
|
|||
if rq == nil {
|
||||
return q
|
||||
}
|
||||
|
||||
if len(rq.Value) > 1 {
|
||||
if rq.Op != pb.RangeField_EQ {
|
||||
return q
|
||||
|
@ -130,6 +125,31 @@ func AddInvertibleField(q *elastic.BoolQuery, field *pb.InvertibleField, name st
|
|||
}
|
||||
}
|
||||
|
||||
func RoundUpReleaseTime(q *elastic.BoolQuery, rq *pb.RangeField, name string) *elastic.BoolQuery {
|
||||
if rq == nil {
|
||||
return q
|
||||
}
|
||||
releaseTimeInt, err := strconv.ParseInt(rq.Value[0], 10, 32)
|
||||
if err != nil {
|
||||
return q
|
||||
}
|
||||
if releaseTimeInt < 0 {
|
||||
releaseTimeInt *= - 1
|
||||
}
|
||||
releaseTime := strconv.Itoa(int(((releaseTimeInt / 360) + 1) * 360))
|
||||
if rq.Op == pb.RangeField_EQ {
|
||||
return q.Must(elastic.NewTermQuery(name, releaseTime))
|
||||
} else if rq.Op == pb.RangeField_LT {
|
||||
return q.Must(elastic.NewRangeQuery(name).Lt(releaseTime))
|
||||
} else if rq.Op == pb.RangeField_LTE {
|
||||
return q.Must(elastic.NewRangeQuery(name).Lte(releaseTime))
|
||||
} else if rq.Op == pb.RangeField_GT {
|
||||
return q.Must(elastic.NewRangeQuery(name).Gt(releaseTime))
|
||||
} else { // pb.RangeField_GTE
|
||||
return q.Must(elastic.NewRangeQuery(name).Gte(releaseTime))
|
||||
}
|
||||
}
|
||||
|
||||
// Search /*
|
||||
// Search logic is as follows:
|
||||
// 1) Setup query with params given
|
||||
|
@ -343,8 +363,14 @@ func (s *Server) setupEsQuery(
|
|||
|
||||
replacements := map[string]string{
|
||||
"name": "normalized_name",
|
||||
"normalized": "normalized_name",
|
||||
"claim_name": "normalized_name",
|
||||
"txid": "tx_id",
|
||||
"claim_hash": "_id",
|
||||
"nout": "tx_nout",
|
||||
"reposted": "repost_count",
|
||||
"valid_channel_signature": "is_signature_valid",
|
||||
"claim_id": "_id",
|
||||
"signature_digest": "signature",
|
||||
}
|
||||
|
||||
textFields := map[string]bool{
|
||||
|
@ -360,7 +386,6 @@ func (s *Server) setupEsQuery(
|
|||
"public_key_id": true,
|
||||
"short_url": true,
|
||||
"signature": true,
|
||||
"signature_digest": true,
|
||||
"stream_type": true,
|
||||
"title": true,
|
||||
"tx_id": true,
|
||||
|
@ -440,18 +465,17 @@ func (s *Server) setupEsQuery(
|
|||
}
|
||||
|
||||
if in.PublicKeyId != "" {
|
||||
value := hex.EncodeToString(base58.Decode(in.PublicKeyId)[1:21])
|
||||
q = q.Must(elastic.NewTermQuery("public_key_id.keyword", value))
|
||||
q = q.Must(elastic.NewTermQuery("public_key_id.keyword", in.PublicKeyId))
|
||||
}
|
||||
|
||||
if in.HasChannelSignature {
|
||||
q = q.Must(elastic.NewExistsQuery("signature_digest"))
|
||||
q = q.Must(elastic.NewExistsQuery("signature"))
|
||||
if in.IsSignatureValid != nil {
|
||||
q = q.Must(elastic.NewTermQuery("is_signature_valid", in.IsSignatureValid.Value))
|
||||
}
|
||||
} else if in.IsSignatureValid != nil {
|
||||
q = q.MinimumNumberShouldMatch(1)
|
||||
q = q.Should(elastic.NewBoolQuery().MustNot(elastic.NewExistsQuery("signature_digest")))
|
||||
q = q.Should(elastic.NewBoolQuery().MustNot(elastic.NewExistsQuery("signature")))
|
||||
q = q.Should(elastic.NewTermQuery("is_signature_valid", in.IsSignatureValid.Value))
|
||||
}
|
||||
|
||||
|
@ -474,12 +498,10 @@ func (s *Server) setupEsQuery(
|
|||
q = AddTermField(q, in.Description, "description.keyword")
|
||||
q = AddTermsField(q, in.MediaType, "media_type.keyword")
|
||||
q = AddTermField(q, in.NormalizedName, "normalized_name.keyword")
|
||||
q = AddTermField(q, in.PublicKeyBytes, "public_key_bytes.keyword")
|
||||
q = AddTermField(q, in.ShortUrl, "short_url.keyword")
|
||||
q = AddTermField(q, in.Signature, "signature.keyword")
|
||||
q = AddTermField(q, in.SignatureDigest, "signature_digest.keyword")
|
||||
q = AddTermField(q, in.TxId, "tx_id.keyword")
|
||||
q = AddTermField(q, in.FeeCurrency, "fee_currency.keyword")
|
||||
q = AddTermField(q, strings.ToUpper(in.FeeCurrency), "fee_currency.keyword")
|
||||
q = AddTermField(q, in.RepostedClaimId, "reposted_claim_id.keyword")
|
||||
|
||||
q = AddTermsField(q, s.cleanTags(in.AnyTags), "tags.keyword")
|
||||
|
@ -498,7 +520,7 @@ func (s *Server) setupEsQuery(
|
|||
q = AddRangeField(q, in.CreationHeight, "creation_height")
|
||||
q = AddRangeField(q, in.ActivationHeight, "activation_height")
|
||||
q = AddRangeField(q, in.ExpirationHeight, "expiration_height")
|
||||
q = AddRangeField(q, in.ReleaseTime, "release_time")
|
||||
q = RoundUpReleaseTime(q, in.ReleaseTime, "release_time")
|
||||
q = AddRangeField(q, in.RepostCount, "repost_count")
|
||||
q = AddRangeField(q, in.FeeAmount, "fee_amount")
|
||||
q = AddRangeField(q, in.Duration, "duration")
|
||||
|
@ -506,10 +528,7 @@ func (s *Server) setupEsQuery(
|
|||
q = AddRangeField(q, in.ChannelJoin, "channel_join")
|
||||
q = AddRangeField(q, in.EffectiveAmount, "effective_amount")
|
||||
q = AddRangeField(q, in.SupportAmount, "support_amount")
|
||||
q = AddRangeField(q, in.TrendingGroup, "trending_group")
|
||||
q = AddRangeField(q, in.TrendingMixed, "trending_mixed")
|
||||
q = AddRangeField(q, in.TrendingLocal, "trending_local")
|
||||
q = AddRangeField(q, in.TrendingGlobal, "trending_global")
|
||||
q = AddRangeField(q, in.TrendingScore, "trending_score")
|
||||
|
||||
if in.Text != "" {
|
||||
textQuery := elastic.NewSimpleQueryStringQuery(in.Text).
|
||||
|
@ -685,13 +704,10 @@ func (r *record) recordToOutput() *pb.Output {
|
|||
ActivationHeight: r.ActivationHeight,
|
||||
ExpirationHeight: r.ExpirationHeight,
|
||||
ClaimsInChannel: r.ClaimsInChannel,
|
||||
Reposted: r.Reposted,
|
||||
Reposted: r.RepostCount,
|
||||
EffectiveAmount: r.EffectiveAmount,
|
||||
SupportAmount: r.SupportAmount,
|
||||
TrendingGroup: r.TrendingGroup,
|
||||
TrendingMixed: r.TrendingMixed,
|
||||
TrendingLocal: r.TrendingLocal,
|
||||
TrendingGlobal: r.TrendingGlobal,
|
||||
TrendingScore: r.TrendingScore,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue