Search in sources :

Example 11 with IndexSettings

use of com.enonic.xp.repository.IndexSettings in project xp by enonic.

the class RepositoryNodeTranslator method toNodeData.

private static void toNodeData(final IndexDefinitions indexDefinitions, final PropertyTree data) {
    if (indexDefinitions != null) {
        final PropertySet indexConfigsPropertySet = data.addSet(INDEX_CONFIG_KEY);
        for (IndexType indexType : IndexType.values()) {
            final IndexDefinition indexDefinition = indexDefinitions.get(indexType);
            if (indexDefinition != null) {
                final PropertySet indexConfigPropertySet = indexConfigsPropertySet.addSet(indexType.getName());
                final IndexMapping indexMapping = indexDefinition.getMapping();
                if (indexMapping != null) {
                    final PropertySet indexMappingPropertySet = JsonToPropertyTreeTranslator.translate(indexMapping.getNode()).getRoot();
                    indexConfigPropertySet.setSet(MAPPING_KEY, indexMappingPropertySet);
                }
                final IndexSettings indexSettings = indexDefinition.getSettings();
                if (indexSettings != null) {
                    final PropertySet indexSettingsPropertySet = JsonToPropertyTreeTranslator.translate(indexSettings.getNode()).getRoot();
                    indexConfigPropertySet.setSet(SETTINGS_KEY, indexSettingsPropertySet);
                }
            }
        }
    }
}
Also used : IndexMapping(com.enonic.xp.repository.IndexMapping) IndexDefinition(com.enonic.xp.repository.IndexDefinition) IndexSettings(com.enonic.xp.repository.IndexSettings) PropertySet(com.enonic.xp.data.PropertySet) IndexType(com.enonic.xp.index.IndexType)

Aggregations

IndexSettings (com.enonic.xp.repository.IndexSettings)11 IndexMapping (com.enonic.xp.repository.IndexMapping)4 IndexType (com.enonic.xp.index.IndexType)3 AbstractNodeTest (com.enonic.xp.repo.impl.node.AbstractNodeTest)2 IndexDefinition (com.enonic.xp.repository.IndexDefinition)2 Map (java.util.Map)2 Test (org.junit.jupiter.api.Test)2 PropertySet (com.enonic.xp.data.PropertySet)1 UpdateIndexSettings (com.enonic.xp.repo.impl.index.UpdateIndexSettings)1 IndexDefinitions (com.enonic.xp.repository.IndexDefinitions)1 IndexException (com.enonic.xp.repository.IndexException)1 Repository (com.enonic.xp.repository.Repository)1 RepositoryId (com.enonic.xp.repository.RepositoryId)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ElasticsearchException (org.elasticsearch.ElasticsearchException)1 CreateIndexRequest (org.elasticsearch.action.admin.indices.create.CreateIndexRequest)1 CreateIndexResponse (org.elasticsearch.action.admin.indices.create.CreateIndexResponse)1 ImmutableOpenMap (org.elasticsearch.common.collect.ImmutableOpenMap)1