use of com.enonic.xp.repository.IndexSettings in project xp by enonic.
the class CreateRepositoryHandler method setIndexDefinitions.
public void setIndexDefinitions(final ScriptValue data) {
if (data != null) {
final Map<String, Object> indexDefinitionsMap = data.getMap();
final IndexDefinitions.Builder indexDefinitionsBuilder = IndexDefinitions.create();
for (IndexType indexType : IndexType.values()) {
final Map indexDefinitionMap = (Map) indexDefinitionsMap.get(indexType.getName());
if (indexDefinitionMap != null) {
final Map indexDefinitionSettingsMap = (Map) indexDefinitionMap.get("settings");
IndexSettings indexSettings = indexDefinitionSettingsMap == null ? null : new IndexSettings(createJson(indexDefinitionSettingsMap));
final Map indexDefinitionMappingMap = (Map) indexDefinitionMap.get("mapping");
IndexMapping indexMapping = indexDefinitionMappingMap == null ? null : new IndexMapping(createJson(indexDefinitionMappingMap));
final IndexDefinition indexDefinition = IndexDefinition.create().settings(indexSettings).mapping(indexMapping).build();
indexDefinitionsBuilder.add(indexType, indexDefinition);
}
}
this.indexDefinitions = indexDefinitionsBuilder.build();
}
}
use of com.enonic.xp.repository.IndexSettings in project xp by enonic.
the class StatusResource method createRepoReadOnlyJson.
private JsonNode createRepoReadOnlyJson() {
final IndexSettings indexSettings = this.indexService.getIndexSettings(ContentConstants.CONTENT_REPO_ID, IndexType.SEARCH);
final JsonNode writeJsonNode = indexSettings != null ? indexSettings.getNode().get("index.blocks.write") : null;
return writeJsonNode != null ? writeJsonNode : JsonNodeFactory.instance.booleanNode(false);
}
use of com.enonic.xp.repository.IndexSettings in project xp by enonic.
the class IndexServiceImpl method doPurgeSearchIndex.
private void doPurgeSearchIndex(final RepositoryId repositoryId) {
final String searchIndexName = IndexNameResolver.resolveSearchIndexName(repositoryId);
indexServiceInternal.deleteIndices(searchIndexName);
final IndexSettings indexSettings = getSearchIndexSettings(repositoryId);
final IndexMapping indexMapping = getSearchIndexMapping(repositoryId);
indexServiceInternal.createIndex(CreateIndexRequest.create().indexName(searchIndexName).indexSettings(indexSettings).mappings(Map.of(IndexType.SEARCH, indexMapping)).build());
indexServiceInternal.waitForYellowStatus(searchIndexName);
}
use of com.enonic.xp.repository.IndexSettings in project xp by enonic.
the class NodeRepositoryServiceImpl method mergeWithDefaultSettings.
private IndexSettings mergeWithDefaultSettings(final CreateRepositoryParams params, final IndexType indexType) {
final IndexSettings defaultSettings = getDefaultSettings(params.getRepositoryId(), indexType);
final IndexSettings indexSettings = params.getRepositorySettings().getIndexSettings(indexType);
if (indexSettings != null) {
return new IndexSettings(JsonHelper.merge(defaultSettings.getNode(), indexSettings.getNode()));
}
return defaultSettings;
}
use of com.enonic.xp.repository.IndexSettings in project xp by enonic.
the class NodeRepositoryServiceImpl method createIndex.
private void createIndex(final CreateRepositoryParams params, final IndexType indexType, final Map<IndexType, IndexMapping> mappings) {
final RepositoryId repositoryId = params.getRepositoryId();
final IndexSettings mergedSettings = mergeWithDefaultSettings(params, indexType);
indexServiceInternal.createIndex(CreateIndexRequest.create().indexName(resolveIndexName(repositoryId, indexType)).mappings(mappings).indexSettings(mergedSettings).build());
}
Aggregations