synchronized void importIndexDefinitions() throws RepositoryException { RepositoryConfiguration.Indexes indexes = config.getIndexes(); if (indexes.isEmpty()) return; List<IndexDefinition> defns = new ArrayList<>(); for (String indexName : indexes.getIndexNames()) { IndexDefinition defn = indexes.getIndex(indexName); if (defn != null) defns.add(defn); } if (!defns.isEmpty()) { IndexDefinition[] array = defns.toArray(new IndexDefinition[defns.size()]); registerIndexes(array, true); // Wait while the indexes get created ... try { Thread.sleep(500L + array.length * 50L); } catch (Exception e) { throw new SystemFailureException(e); } // We have to index the '/jcr:system' content, since it was created before these indexes were // registered ... repository.queryManager().reindexSystemContent(); } }