应该是有效的吧,看设置的boost有没有生效,你要看Explanation对象的,不是从索引库中去除对应文档的各个field信息。
Explanation explanation = searcher.explain(query, match.doc);
System.out.println(explanation.toString());
类似以下输出:
Document: one two
0.5945348 = (MATCH) weight(content:two in 0), product of:
0.99999994 = queryWeight(content:two), product of:
0.5945349 = idf(docFreq=2, maxDocs=2)
1.681987 = queryNorm
0.5945349 = (MATCH) fieldWeight(content:two in 0), product of:
1.0 = tf(termFreq(content:two)=1)
0.5945349 = idf(docFreq=2, maxDocs=2)
1.0 = fieldNorm(field=content, doc=0)
你看你设置的boost有么有生效,可以设置两次boost,然后对比两个Explanation的queryweight。不同就是生效了。