Exemplo n.º 1
0
 private Document getDocument(JournalEntry entry) {
   Document doc = new Document();
   doc.add(
       new Field(
           EntryIndexFields.ID.name(),
           entry.getUid().toString(),
           Field.Store.YES,
           Field.Index.NOT_ANALYZED));
   doc.add(
       new Field(
           EntryIndexFields.NAME.name(),
           entry.getName(),
           Field.Store.YES,
           Field.Index.NOT_ANALYZED));
   doc.add(
       new Field(
           EntryIndexFields.FULLTEXT.name(),
           entry.getText(),
           Field.Store.YES,
           Field.Index.ANALYZED));
   doc.add(
       new Field(
           EntryIndexFields.DATE.name(),
           Long.toString(entry.getDateTime().getMillis()),
           Field.Store.YES,
           Field.Index.NOT_ANALYZED));
   doc.add(
       new Field(
           EntryIndexFields.TYPE.name(),
           entry.getItemType().name(),
           Field.Store.YES,
           Field.Index.NOT_ANALYZED));
   return doc;
 }
Exemplo n.º 2
0
 @Override
 public void DeleteEntry(JournalEntry entry) {
   wrapper.DeleteDocuments(new Term(EntryIndexFields.ID.name(), entry.getUid().toString()));
 }
Exemplo n.º 3
0
 @Override
 public void UpdateEntry(JournalEntry entry) {
   wrapper.ReplaceDocument(
       getDocument(entry), new Term(EntryIndexFields.ID.name(), entry.getUid().toString()));
 }