Skip to content

Commit da69c07

Browse files
committed
ZEPPELIN-501: validate notes before update index
1 parent 5f47890 commit da69c07

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

zeppelin-zengine/src/main/java/org/apache/zeppelin/search/SearchService.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,21 @@ public void updateIndexDoc(Note note) throws IOException {
180180
}
181181

182182
private void updateIndexNoteName(Note note) throws IOException {
183-
updateDoc(note.getId(), note.getName(), null);
183+
String noteName = note.getName();
184+
String noteId = note.getId();
185+
LOG.debug("Indexing Notebook {}, '{}'", noteId, noteName);
186+
if (null == noteName || noteName.isEmpty()) {
187+
LOG.debug("Skipping empty notebook name");
188+
return;
189+
}
190+
updateDoc(noteId, noteName, null);
184191
}
185192

186193
private void updateIndexParagraph(Note note, Paragraph p) throws IOException {
194+
if (p.getText() == null) {
195+
LOG.debug("Skipping empty paragraph");
196+
return;
197+
}
187198
updateDoc(note.getId(), note.getName(), p);
188199
}
189200

0 commit comments

Comments
 (0)