rocksdb #29

Merged
jeffreypicard merged 93 commits from feature/27/jeffreypicard/rocksdb into master 2022-04-29 17:04:01 +02:00
4 changed files with 16 additions and 2 deletions
Showing only changes of commit 8cb0d1fdb8 - Show all commits

View file

@ -120,4 +120,5 @@ message SearchRequest {
repeated string all_languages = 56; repeated string all_languages = 56;
bool remove_duplicates = 57; bool remove_duplicates = 57;
bool no_totals = 58; bool no_totals = 58;
string sd_hash = 59;
} }

View file

@ -588,6 +588,7 @@ type SearchRequest struct {
AllLanguages []string `protobuf:"bytes,56,rep,name=all_languages,json=allLanguages,proto3" json:"all_languages"` AllLanguages []string `protobuf:"bytes,56,rep,name=all_languages,json=allLanguages,proto3" json:"all_languages"`
RemoveDuplicates bool `protobuf:"varint,57,opt,name=remove_duplicates,json=removeDuplicates,proto3" json:"remove_duplicates"` RemoveDuplicates bool `protobuf:"varint,57,opt,name=remove_duplicates,json=removeDuplicates,proto3" json:"remove_duplicates"`
NoTotals bool `protobuf:"varint,58,opt,name=no_totals,json=noTotals,proto3" json:"no_totals"` NoTotals bool `protobuf:"varint,58,opt,name=no_totals,json=noTotals,proto3" json:"no_totals"`
SdHash string `protobuf:"bytes,59,opt,name=sd_hash,json=sdHash,proto3" json:"sd_hash"`
} }
func (x *SearchRequest) Reset() { func (x *SearchRequest) Reset() {
@ -1000,6 +1001,13 @@ func (x *SearchRequest) GetNoTotals() bool {
return false return false
} }
func (x *SearchRequest) GetSdHash() string {
if x != nil {
return x.SdHash
}
return ""
}
var File_hub_proto protoreflect.FileDescriptor var File_hub_proto protoreflect.FileDescriptor
var file_hub_proto_rawDesc = []byte{ var file_hub_proto_rawDesc = []byte{

View file

@ -260,6 +260,7 @@ func (s *Server) Search(ctx context.Context, in *pb.SearchRequest) (*pb.Outputs,
res, err := client.IndexStats(searchIndices[0]).Do(ctx) res, err := client.IndexStats(searchIndices[0]).Do(ctx)
if err != nil { if err != nil {
log.Printf("Error on ES index stats\n%v\n", err) log.Printf("Error on ES index stats\n%v\n", err)
return &pb.Outputs{}, nil
} }
numRefreshes := res.Indices[searchIndices[0]].Primaries.Refresh.Total numRefreshes := res.Indices[searchIndices[0]].Primaries.Refresh.Total
if numRefreshes != s.NumESRefreshes { if numRefreshes != s.NumESRefreshes {
@ -595,6 +596,10 @@ func (s *Server) setupEsQuery(
q = q.Must(elastic.NewTermsQuery("stream_type", searchVals...)) q = q.Must(elastic.NewTermsQuery("stream_type", searchVals...))
} }
if in.SdHash != "" {
q.Must(elastic.NewPrefixQuery("sd_hash.keyword", in.SdHash))
}
if in.ClaimId != nil { if in.ClaimId != nil {
searchVals := StrArrToInterface(in.ClaimId.Value) searchVals := StrArrToInterface(in.ClaimId.Value)
if len(in.ClaimId.Value) == 1 && len(in.ClaimId.Value[0]) < 20 { if len(in.ClaimId.Value) == 1 && len(in.ClaimId.Value[0]) < 20 {

View file

@ -1 +1 @@
v0.2021.12.06.1 v0.2022.01.21.1