luncen检索时字段对应多个值

检索关键词拼上:AND BGQX:(“D10”,“D30”) AND ND:(“2022”,“2021”)//注意这里的AND需要大写

//分词时需要设置字段能够匹配多个值
Analyzer analyzer = new IKAnalyzer();
StandardQueryParser queryParser = new StandardQueryParser(analyzer);
for(String sql1:sqls) {
			String  field1=sql1.split(":")[0].trim();
			flfields.add(field1);
}
//["BGQX","ND"]
queryParser.setMultiFields(flfields.toArray(new String[sqls.length]));

你可能感兴趣的:(java)