Skip to content

Commit

Permalink
add sd_hash prefix search (#30)
Browse files Browse the repository at this point in the history
* add sd_hash to search request

* search sd_hash by prefix
  • Loading branch information
shyba authored Dec 17, 2021
1 parent 447e931 commit 8e99bc5
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 36 deletions.
3 changes: 2 additions & 1 deletion protobuf/definitions/hub.proto
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,5 @@ message SearchRequest {
repeated string all_languages = 56;
bool remove_duplicates = 57;
bool no_totals = 58;
}
string sd_hash = 59;
}
2 changes: 1 addition & 1 deletion protobuf/go/claim.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 38 additions & 29 deletions protobuf/go/hub.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion protobuf/go/result.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions protobuf/python/hub_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions server/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,10 @@ func (s *Server) setupEsQuery(
q = q.Must(elastic.NewTermsQuery("stream_type", searchVals...))
}

if in.SdHash != "" {
q.Must(elastic.NewPrefixQuery("sd_hash.keyword", in.SdHash))
}

if in.ClaimId != nil {
searchVals := StrArrToInterface(in.ClaimId.Value)
if len(in.ClaimId.Value) == 1 && len(in.ClaimId.Value[0]) < 20 {
Expand Down

0 comments on commit 8e99bc5

Please sign in to comment.