Skip to content

Commit

Permalink
Change VectorReaderListener to expect number array (#417)
Browse files Browse the repository at this point in the history
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 <[email protected]>
(cherry picked from commit 7735351)
  • Loading branch information
opensearch-trigger-bot[bot] authored Jun 3, 2022
1 parent 55717ed commit 7fcd603
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 7fcd603

Please sign in to comment.