Skip to content

Commit

Permalink
Change VectorReaderListener to expect number array (opensearch-projec…
Browse files Browse the repository at this point in the history
…t#416)

Refactors VectorReaderListener onResponse to expect arrays of Number
type from search result instead of Double type. Adds test case to
confirm that it can handle Integer type. Cleans up tests in
VectorReaderTest class.

Signed-off-by: John Mazanec <jmazane@amazon.com>
  • Loading branch information
jmazanec15 authored Jun 3, 2022
1 parent dbe32fc commit 7735351
Show file tree
Hide file tree
Showing 2 changed files with 176 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public void onResponse(SearchResponse searchResponse) {

for (int i = 0; i < vectorsToAdd; i++) {
trainingData.add(
((List<Double>) hits[i].getSourceAsMap().get(fieldName)).stream().map(Double::floatValue).toArray(Float[]::new)
((List<Number>) hits[i].getSourceAsMap().get(fieldName)).stream().map(Number::floatValue).toArray(Float[]::new)
);
}

Expand Down
Loading

0 comments on commit 7735351

Please sign in to comment.