neo4j模糊查询

neo4j 单个模糊查询

1) 使用 =~’.模糊匹配对象.’ 进行表示

  • 匹配关系
    MATCH p=()-[r:company_notice]->() where r.CATE=~'.*反.*' RETURN p 
    
  • 匹配节点
    match (n:notice) where n.TITLE=~'.*2008.*' return n
    

2)使用关键字 starts with、 ends with、Contains 进行表示

starts with

  • 匹配关系
    MATCH p=()-[r:company_notice]->() where r.CATE starts with '反' RETURN p 
    
  • 匹配节点
    match (n:notice) where n.TITLE starts with '海' return n
    

ends with

  • 匹配关系
    MATCH p=()-[r:company_notice]->() where r.CATE ends with '销' RETURN p
    
  • 匹配节点
    match (n:notice) where n.TITLE ends with '洋' return n
    

Contains

  • 匹配关系
    MATCH p=()-[r:company_notice]->() where r.CATE Contains '反' RETURN p 
    
  • 匹配节点
    match (n:notice) where n.TITLE Contains '2008' return n
    

neo4j多个对象的模糊查询

1) 使用 =~’.模糊匹配对象.’ 进行表示

  • 匹配节点
    match (n:notice) where n.TITLE=~'.*2008.*|.*2007.*' return n
    
    match (n:notice) where n.TITLE=~'.*2008.*'  or n.TITLE=~'.*2007.*' return n
    

比较操作符

=  # 注意是单个的'='号,不是两个
<>
<
>
<=
>=

逻辑(布尔)运算符

AND
OR
NOT
XOR

你可能感兴趣的:(数据库管理,neo4j,模糊查询)