@Test public void indexParagraphUpdatedOnNoteSave() throws IOException {

  //given: total 2 notebooks, 3 paragraphs
  Note note1 = newNoteWithParagraph("Notebook1", "test");
  Note note2 = newNoteWithParagraphs("Notebook2", "not test", "not test at all");
  notebookIndex.addIndexDocs(Arrays.asList(note1, note2));
  assertThat(resultForQuery("test").size()).isEqualTo(3);
  //when
  Paragraph p1 = note1.getLastParagraph();
  p1.setText("no no no");
  note1.persist(null);
  //then
  assertThat(resultForQuery("Notebook1").size()).isEqualTo(1);
  List<Map<String, String>> results = resultForQuery("test");
  assertThat(results).isNotEmpty();
  assertThat(results.size()).isEqualTo(2);
  //does not include Notebook1's paragraph any more
  for (Map<String, String> result: results) {
    assertThat(result.get("id").startsWith(note1.getId())).isFalse();;
  }
}