IndexSearcher在进行排序的时候,可以设置两个参数,doDocScores和doMaxScore,对于排序来说,计算分数本身没有意义,因此,默认情况下,排序后命中的文档是不计算得分,但是,通常排序是多维度的,可能也需要文档得分的参考,这时候就需要进行相关的设置,这也意味着更多的系统开销。
doDocScores很好理解,但是doMaxScore就麻烦了。之前看到有知名的Lucene博文这样解释。http://iamyida.iteye.com/blog/2197839
看似很有道理,但实际上不难。 Lucene官方文档怎么说呢
If doDocScores
is true
then the score of each hit will be computed and returned. If doMaxScore
is true
then the maximum score over all collected hits will be computed
实际上,只是计算整个命中文档的最高分而已。以Lucene文档为主。