Skip to content

Commit d625ddc

Browse files
committed
fix(main.js): 修复highlight为undefined的bug
1 parent c4eef9f commit d625ddc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

api/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ app.get('/', function(req, res) {
113113
results = results.hits.hits;
114114
results = results.map((e) => {
115115
let highlight = [];
116-
if (!e.highlight.content && !e.highlight.h2) {
116+
if (!e.highlight || (!e.highlight.content && !e.highlight.h2)) {
117117
highlight = [e._source.content.substring(0, 30)];
118118
} else if (e.highlight.content && e.highlight.h2) {
119119
const contentCount = count(e.highlight.content[0]);

0 commit comments

Comments
 (0)