mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Rename variables
This commit is contained in:
parent
0a86cb6c4d
commit
0df086e07f
@ -147,10 +147,10 @@ MATCH (c:Category {id: categoryId})
|
||||
MERGE (p)-[:CATEGORIZED]->(c)
|
||||
WITH p, post.tags AS tags
|
||||
UNWIND tags AS tag
|
||||
WITH '[^\\p{L}0-9]' as regexMatchAllNonUnicodeOrDigits
|
||||
WITH apoc.text.replace(tag, regexMatchAllNonUnicodeOrDigits, '') as tagNoSpacesAllowed
|
||||
WITH '^((\\p{L}+[\\p{L}0-9]*)|([0-9]+\\p{L}+[\\p{L}0-9]*))$' as regexHashtagMustNotIncludeOnlyDigits
|
||||
CALL apoc.when(tagNoSpacesAllowed =~ regexHashtagMustNotIncludeOnlyDigits, 'RETURN tagNoSpacesAllowed', '', {tagNoSpacesAllowed: tagNoSpacesAllowed})
|
||||
WITH '[^\\p{L}0-9]' as regexMatchAllNonUnicodeLettersOrDigits
|
||||
WITH apoc.text.replace(tag, regexMatchAllNonUnicodeLettersOrDigits, '') as tagNoSpacesAllowed
|
||||
WITH '^((\\p{L}+[\\p{L}0-9]*)|([0-9]+\\p{L}+[\\p{L}0-9]*))$' as regexHashtagMustIncludeOnlyUnicodeLettersOrDigitsButNotOnlyDigits
|
||||
CALL apoc.when(tagNoSpacesAllowed =~ regexHashtagMustIncludeOnlyUnicodeLettersOrDigitsButNotOnlyDigits, 'RETURN tagNoSpacesAllowed', '', {tagNoSpacesAllowed: tagNoSpacesAllowed})
|
||||
YIELD value as validated
|
||||
WHERE validated.tagNoSpacesAllowed IS NOT NULL
|
||||
MERGE (t:Tag { id: validated.tagNoSpacesAllowed, disabled: false, deleted: false })
|
||||
|
||||
@ -215,8 +215,9 @@ export default {
|
||||
},
|
||||
sanitizeQuery(query) {
|
||||
if (this.suggestionType === HASHTAG) {
|
||||
const regexMatchAllNonUnicodeOrDigits = build('[^\\pL0-9]')
|
||||
query = replace(query, regexMatchAllNonUnicodeOrDigits, '', 'all')
|
||||
// remove all non unicode letters and non digits
|
||||
const regexMatchAllNonUnicodeLettersOrDigits = build('[^\\pL0-9]')
|
||||
query = replace(query, regexMatchAllNonUnicodeLettersOrDigits, '', 'all')
|
||||
// if the query is only made of digits, make it empty
|
||||
return query.replace(/[0-9]/gm, '') === '' ? '' : query
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user