Skip to content

Commit

Permalink
Checking if fetched values is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
afoucret committed Jan 12, 2024
1 parent ed8c980 commit dd8da55
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public void setNextReader(LeafReaderContext segmentContext) {
public void addFeatures(Map<String, Object> featureMap, int docId) throws IOException {
Source source = sourceLookup.getSource(this.segmentContext, docId);
for (FieldValueFetcher vf : this.valueFetcherList) {
featureMap.put(vf.fieldName(), vf.valueFetcher().fetchValues(source, docId, new ArrayList<>()).get(0));
List<Object> values = vf.valueFetcher().fetchValues(source, docId, new ArrayList<>());
if (values.isEmpty() == false) {
featureMap.put(vf.fieldName(), values.get(0));
}
}
}

Expand Down

0 comments on commit dd8da55

Please sign in to comment.