private IDictionary <string, string> GetOrCreateIndexConfig(IndexEntityType entityType, string indexName, IDictionary <string, string> suppliedConfig) { IDictionary <string, string> config = FindIndexConfig(entityType.entityClass(), indexName, suppliedConfig, this._config); if (!_indexStore.has(entityType.entityClass(), indexName)) { // Ok, we need to create this config lock (this) { // Were we the first ones to get here? IDictionary <string, string> existing = _indexStore.get(entityType.entityClass(), indexName); if (existing != null) { // No, someone else made it before us, cool AssertConfigMatches(_explicitIndexProvider.getProviderByName(existing[PROVIDER]), indexName, existing, config); return(config); } // We were the first one here, let's create this config try { using (Transaction transaction = _kernel.get().beginTransaction([email protected]_Type.Implicit, AUTH_DISABLED), Statement statement = ((KernelTransaction)transaction).acquireStatement()) { switch (entityType.innerEnumValue) { case Node: transaction.IndexWrite().nodeExplicitIndexCreate(indexName, config); break; case Relationship: transaction.IndexWrite().relationshipExplicitIndexCreate(indexName, config); break; default: throw new System.ArgumentException("Unknown entity type: " + entityType); } transaction.Success(); } } catch (Exception ex) { throw new TransactionFailureException("Index creation failed for " + indexName + ", " + config, ex); } } } return(config); }
public override string ToString() { return("Delete[index:" + IndexNameIdConflict + ", type:" + IndexEntityType.byId(EntityTypeConflict).nameToLowerCase() + "]"); }
public override string ToString() { return(format("Create%sIndex[index:%d, config:%s]", IndexEntityType.byId(EntityTypeConflict).nameToLowerCase(), IndexNameIdConflict, ConfigConflict)); }
public override string ToString() { return(format("Remove%s[index:%d, id:%d, key:%d, value:%s]", IndexEntityType.byId(EntityTypeConflict).nameToLowerCase(), IndexNameIdConflict, EntityIdConflict, KeyIdConflict, ValueConflict)); }