//匹配articleType
QueryBuilder articleType = QueryBuilders.multiMatchQuery(searchVo.getArticleType(),"articleType");
QueryBuilder multiMatch = QueryBuilders.wildcardQuery("articleTitle","*"+key+"*"); QueryBuilder multiMatch2 = QueryBuilders.wildcardQuery("articleContent","*"+key+"*"); builder.setQuery(QueryBuilders.boolQuery().must(articleType).should(multiMatch).should(multiMatch2));
当不添加must的查询时,查询结果很满意,一旦加上must这个查询就会把很多不该查询出来的数据一起带出来
2 个回复
rochy - rochy_he
赞同来自:
menzhipeng
赞同来自:
QueryBuilder tagId = QueryBuilders.multiMatchQuery("allTags.id",value) 这样?