我正在按照documentation使用FeatureField。
Query query = queryParser.parse("java")
Query boost1 = FeatureField.newSaturationQuery("answerCount", "answerCountRank", 32.0f, 1.0f)
Query boost2 = FeatureField.newSaturationQuery("score", "scoreRank", 16.0f, 10.0f)
Query boostedQuery = new BooleanQuery.Builder()
.add(query, Occur.MUST)
.add(boost1, Occur.SHOULD)
.add(boost2, Occur.SHOULD)
.build();
TopDocs topDocs = searcher.search(boostedQuery, 10);
说明计划如下:
99.17551 = sum of:
| 60.318367 = sum of:
| | 29.584406 = weight(title:java in 33486) [BM25Similarity], result of:
| | | 29.584406 = score(freq=2.0), product of:
| | | | 10.0 = boost
| | | | 5.888589 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:
| | | | | 263 = n, number of documents containing term
| | | | | 95095 = N, total number of documents with field
| | | | 0.5024023 = tf, computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:
| | | | | 2.0 = freq, occurrences of term within document
| | | | | 1.2 = k1, term saturation parameter
| | | | | 0.75 = b, length normalization parameter
| | | | | 18.0 = dl, length of field
| | | | | 9.637846 = avgdl, average length of field
| | 30.733963 = weight(aggregatedTextContent:java in 33486) [BM25Similarity], result of:
| | | 30.733963 = score(freq=83.0), product of:
| | | | 7.0 = boost
| | | | 4.565105 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:
| | | | | 1004 = n, number of documents containing term
| | | | | 96504 = N, total number of documents with field
| | | | 0.9617668 = tf, computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:
| | | | | 83.0 = freq, occurrences of term within document
| | | | | 1.2 = k1, term saturation parameter
| | | | | 0.75 = b, length normalization parameter
| | | | | 1560.0 = dl, length of field (approximate)
| | | | | 468.077 = avgdl, average length of field
| 26.666666 = Saturation function on the answerCount field for the answerCountRank feature, computed as w * S / (S + k) from:
| | 32.0 = w, weight of this function
| | 1.0 = k, pivot feature value that would give a score contribution equal to w/2
| | 5.0 = S, feature value
| 12.190476 = Saturation function on the score field for the scoreRank feature, computed as w * S / (S + k) from:
| | 16.0 = w, weight of this function
| | 10.0 = k, pivot feature value that would give a score contribution equal to w/2
| | 32.0 = S, feature value
...如您所见,总分数是原始查询分数的 sum 加两个提升查询的分数。即60.318367 + 26.666666 + 12.190476
相反,我希望总分是原始得分的乘积和两个提升查询的得分。即60.318367 * 26.666666 * 12.190476
任何帮助将不胜感激