From 25bac9a84ca24d2e2c93bc5bfdf0f950f9b5461e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 26 Aug 2019 18:24:21 +0200 Subject: [PATCH] Correct the import of tags from the Alpha Remove the tags which can not be corrected. Co-Authored-By: Ulf Gebhardt --- .../migration/neo4j/contributions/contributions.cql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql index af81528f2..0462310c6 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql @@ -147,7 +147,8 @@ UNWIND categoryIds AS categoryId MATCH (c:Category {id: categoryId}) MERGE (p)-[:CATEGORIZED]->(c) WITH p, post.tags AS tags -UNWIND tags AS tag -MERGE (t:Tag {id: apoc.text.clean(tag), disabled: false, deleted: false}) +UNWIND apoc.text.replace(tags, '/[^a-z^A-Z^0-9]{1}/g', '') AS tag +WHERE size(apoc.text.regexGroups(tag, '/^(([a-zA-Z]+[a-zA-Z0-9]*)|([0-9]+[a-zA-Z]+[a-zA-Z0-9]*))$/g')) >= 1 +MERGE (t:Tag { id: tag, disabled: false, deleted: false }) MERGE (p)-[:TAGGED]->(t) ;