ZEPPELIN-501: validate notes before update index

This commit is contained in:
Alexander Bezzubov 2015-12-22 19:23:17 +09:00
parent 5f47890e71
commit da69c07737

View file

@ -180,10 +180,21 @@ public class SearchService {
}
private void updateIndexNoteName(Note note) throws IOException {
updateDoc(note.getId(), note.getName(), null);
String noteName = note.getName();
String noteId = note.getId();
LOG.debug("Indexing Notebook {}, '{}'", noteId, noteName);
if (null == noteName || noteName.isEmpty()) {
LOG.debug("Skipping empty notebook name");
return;
}
updateDoc(noteId, noteName, null);
}
private void updateIndexParagraph(Note note, Paragraph p) throws IOException {
if (p.getText() == null) {
LOG.debug("Skipping empty paragraph");
return;
}
updateDoc(note.getId(), note.getName(), p);
}