Example #1
0
 @Override
 public void create(Create create) throws EngineException {
   rwl.readLock().lock();
   try {
     IndexWriter writer = this.indexWriter;
     if (writer == null) {
       throw new EngineClosedException(shardId);
     }
     writer.addDocument(create.doc(), create.analyzer());
     translog.add(new Translog.Create(create));
     dirty = true;
     if (create.refresh()) {
       refresh(new Refresh(false));
     }
   } catch (IOException e) {
     throw new CreateFailedEngineException(shardId, create, e);
   } finally {
     rwl.readLock().unlock();
   }
 }