模糊查询  regex(".*?\\"+questionContent+".*")

        String questionContent = "需求";
        Query query = new Query();
        query.addCriteria(Criteria.where("demandName").regex(".*?\\"+questionContent+".*"));
        
        System.out.println(mongo.count(query, AdvTrusteeship.class));

 

// 解决模糊查询 数字查不出结果【最终版】

 Pattern pattern = Pattern.compile("^.*" + situation.getTitle() + ".*$", Pattern.CASE_INSENSITIVE);
 query.addCriteria(Criteria.where("title").regex(pattern));

 

相关文章:

  • 2022-12-23
  • 2021-06-14
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2022-02-01
  • 2022-01-07
猜你喜欢
  • 2021-10-12
  • 2022-12-23
  • 2021-06-26
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案