Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce protobuf serialization for objects - FetchSearchResult, SearchHits, SearchHit #15372

Closed
wants to merge 61 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
0f94bf8
SerDe interfaces
finnegancarroll Aug 21, 2024
1dbe9c1
Nest SerDe interfaces
finnegancarroll Aug 21, 2024
cfd3d7f
Add serialization interface for select serializable classes
finnegancarroll Aug 21, 2024
d457b8d
Port verbatim SearchHit fromstream implementation to SerDe class
finnegancarroll Aug 21, 2024
f3dc35e
Cleanup SearchHit serialization code move
finnegancarroll Aug 22, 2024
992a032
Move SearchHit serialization to SerDe class
finnegancarroll Aug 22, 2024
8a31e75
Swap out old serde in SearchHit - prefer serde done through dedicated…
finnegancarroll Aug 22, 2024
e6be014
Use toStream with serialize
finnegancarroll Aug 22, 2024
61746b6
Decorator + import housekeeping
finnegancarroll Aug 22, 2024
c2d3856
Spotless apply
finnegancarroll Aug 22, 2024
abbefe9
Move SearchHitS serialization to SerDe class
finnegancarroll Aug 22, 2024
127ab38
Move FetchSearchResults serialization to FetchSearchResultsSerDe
finnegancarroll Aug 22, 2024
8e696bc
Spotless apply
finnegancarroll Aug 22, 2024
97f9f03
Fix deserialize - leave null maps null, not empty
finnegancarroll Aug 22, 2024
7c7322f
index & clusterAlias set by helper
finnegancarroll Aug 23, 2024
df7cdb3
Javadoc
finnegancarroll Aug 23, 2024
298182c
Comment
finnegancarroll Aug 23, 2024
fbb1feb
Javadocs
finnegancarroll Aug 23, 2024
7db42cb
Begin proto implementation
finnegancarroll Aug 23, 2024
a183e63
SearchHits to proto initial implementation - Not tested
finnegancarroll Aug 23, 2024
60bdf82
SearchHit from proto impl
finnegancarroll Aug 25, 2024
0fc2b3e
SearchHit from proto impl
finnegancarroll Aug 25, 2024
5595913
Update SearchHits proto def
finnegancarroll Aug 25, 2024
21cc29e
Tentative toProto fromProto implementations for topHits
finnegancarroll Aug 25, 2024
7f1c025
Refactor to inheritance based model
finnegancarroll Aug 26, 2024
76171a8
Break SerDe switch
finnegancarroll Aug 27, 2024
db70801
Add generated protobuf to runAnt accepted licenses
finnegancarroll Aug 27, 2024
2f4903a
Spotless apply
finnegancarroll Aug 27, 2024
2bee1b5
Restore intellij refactor error
finnegancarroll Aug 27, 2024
6ef20c8
Remove strategy wrapper. Just implement protobuf in new object, leave…
finnegancarroll Aug 27, 2024
b7291e1
Passing unit tests for primitive proto objects
finnegancarroll Aug 28, 2024
881f047
Bugfix nullable objects
finnegancarroll Aug 28, 2024
a6f0b90
Handle null explanation
finnegancarroll Aug 28, 2024
daa6ddd
Handle null totHits
finnegancarroll Aug 28, 2024
7ebe020
Explicitely set optional values to null
finnegancarroll Aug 28, 2024
c3efe2a
SearchHit/SearchHits equals() check for instance of class - Not exact…
finnegancarroll Aug 28, 2024
ea8c46f
SearchHitProto fromProto maps never null, only empty
finnegancarroll Aug 28, 2024
21f8b9e
totalHits to optional
finnegancarroll Aug 28, 2024
f86acfe
totalHits to nullable
finnegancarroll Aug 28, 2024
6e57629
Update SearchHits proto def w/ optional fields
finnegancarroll Aug 28, 2024
4a3a463
Spotless apply
finnegancarroll Aug 28, 2024
e4c2277
Collapse field to optional
finnegancarroll Aug 29, 2024
9a2838b
Seperate proto defs a bit
finnegancarroll Aug 30, 2024
bdf5084
SearchHit id to optional - Sort values to proto
finnegancarroll Sep 9, 2024
406bfbc
Decompose SearchHits sortFields to protobuf
finnegancarroll Sep 9, 2024
49c2766
SortValues to proto
finnegancarroll Sep 11, 2024
ff2e8bf
SortValues can be null - Different from optional
finnegancarroll Sep 11, 2024
61676fa
SortValues comment
finnegancarroll Sep 11, 2024
47f076d
Refactor SearchHitsProto tests
finnegancarroll Sep 18, 2024
8bb96c0
No assert not equals for potentially primitive types
finnegancarroll Sep 18, 2024
d7612de
Collapse+Sort arrays to optional
finnegancarroll Sep 18, 2024
b20bddf
Add SearchHitProtobufTests
finnegancarroll Sep 18, 2024
512c574
Mark SearchHit members as nullable where applicable
finnegancarroll Sep 18, 2024
961f035
Decompose toProto/fromProto
finnegancarroll Sep 18, 2024
69450ef
Fix innerHits nullable map
finnegancarroll Sep 18, 2024
faac1ae
Fix SortValue test when null
finnegancarroll Sep 18, 2024
47da14a
Move serde helpers into specific class definitions
finnegancarroll Sep 18, 2024
0255df3
Fix possible switch fall through
finnegancarroll Sep 18, 2024
4021722
Spotless apply
finnegancarroll Sep 18, 2024
7f4e887
Proto folder should mirror project structure
finnegancarroll Sep 23, 2024
9c79d90
Fix import
finnegancarroll Sep 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
totalHits to optional
Signed-off-by: Finn Carroll <carrofin@amazon.com>
  • Loading branch information
finnegancarroll committed Oct 15, 2024
commit 21f8b9edc48ec64674cd8237f514a01777edfdfa
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,16 @@ void fromProto(SearchHitsProto proto) throws ProtoSerDeHelpers.SerializationExce
maxScore = proto.getMaxScore();
collapseField = proto.getCollapseField();

TotalHitsProto totHitsProto = proto.getTotalHits();
long rel = totHitsProto.getRelation();
long val = totHitsProto.getValue();
if (rel < 0 || rel >= TotalHits.Relation.values().length) {
throw new ProtoSerDeHelpers.SerializationException("Failed to deserialize TotalHits from proto");
if (proto.hasTotalHits()) {
long rel = proto.getTotalHits().getRelation();
long val = proto.getTotalHits().getValue();
if (rel < 0 || rel >= TotalHits.Relation.values().length) {
throw new ProtoSerDeHelpers.SerializationException("Failed to deserialize TotalHits from proto");
}
totalHits = new TotalHits(val, TotalHits.Relation.values()[(int) rel]);
} else {
totalHits = null;
}
totalHits = new TotalHits(val, TotalHits.Relation.values()[(int) rel]);

try (StreamInput sortBytesInput = new BytesArray(proto.getSortFields().toByteArray()).streamInput()) {
sortFields = sortBytesInput.readOptionalArray(Lucene::readSortField, SortField[]::new);
Expand Down