Skip to content

Commit 3892946

Browse files
authored
Merge pull request #48 from CBIIT/INS-1515
INS-1515
2 parents 7006c2b + 45fefc3 commit 3892946

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Services/dataset.service.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,18 @@ const search = async (searchText, filters, options) => {
7979

8080
// Rename return fields and highlights according to mappings
8181
const content = Object.keys(DATASET_SEARCH_RETURN_MAPPING).reduce((acc, key) => {
82+
if (!ds._source || !ds._source.hasOwnProperty(key)) {
83+
return acc;
84+
}
85+
8286
acc[DATASET_SEARCH_RETURN_MAPPING[key]] = ds._source[key];
8387
return acc;
8488
}, {});
8589
const highlight = Object.keys(DATASET_SEARCH_RETURN_MAPPING).reduce((acc, key) => {
90+
if (!ds.highlight || !ds.highlight.hasOwnProperty(`${key}.search`)) {
91+
return acc;
92+
}
93+
8694
acc[DATASET_SEARCH_RETURN_MAPPING[key]] = ds.highlight[`${key}.search`];
8795
return acc;
8896
}, {});

0 commit comments

Comments
 (0)