code: public void indexDocument(final ODocument iDocument) {
      modificationLock.requestModificationLock();
  
      try {
        Object fieldValue;
  
        for (final String fieldName : iDocument.fieldNames()) {
          fieldValue = iDocument.field(fieldName);
          put(fieldValue, iDocument);
        }
  
        acquireExclusiveLock();
        try {
  
          map.save();
  
        } finally {
          releaseExclusiveLock();
        }
      } finally {
        modificationLock.releaseModificationLock();
      }
    }
docs: Index an entire document field by field and save the index at the end.
  
  @param iDocument
  The document to index