I have a single node containing domain names.
MATCH (n) RETURN n.name
"n.name" │
╞══════════════════════════╡
│""test01.bo-prod.htb"" │
├──────────────────────────┤
│""test01.bo-prod.local""│
├──────────────────────────┤
│""testa01.bo-prod.intra""│
├──────────────────────────┤
│""testa01.bo-prod.com"" │
├──────────────────────────┤
│""testa01.bo-prod.net"" │
└──────────────────────────┘
What is the most efficient way to RETURN only the domain names which are not local(exclude.intra, .local, .htb)? I am trying to avoid using regular expression search for performance reasons.
You can create a node label for that purpose then use the label when doing your query. For example:
Create the label, NonLocal
WITH ['.intra', '.local', '.htb'] as excluded MATCH (n) WHERE not (any (x in excluded WHERE n.name contains x) ) SET n:NonLocal
You query becomes
MATCH (n:NonLocal) RETURN n
Reference: https://neo4j.com/docs/cypher-manual/current/clauses/set/#set-set-a-label-on-a-node
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.