@OperationMethod public void run(DocumentModel doc) { checkAccess(); // 1. delete existing index IndexingCommand cmd = new IndexingCommand(doc, IndexingCommand.Type.DELETE, false, true); esi.runIndexingWorker(Arrays.asList(cmd)); // 2. wait for the deletion to be completed try { esa.prepareWaitForIndexing().get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new NuxeoException("Interrupted"); } catch (ExecutionException e) { throw new NuxeoException(e); } // 3. index recursive from path cmd = new IndexingCommand(doc, IndexingCommand.Type.INSERT, false, true); esi.runIndexingWorker(Arrays.asList(cmd)); }
throw new TimeoutException(); esa.prepareWaitForIndexing().get(computeRemainingTime(start), TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt();