我使用了solr 6.1,
我需要在每个结果中自定义分数,
这是原始结果:
[
{
"_id": "59d2face138d070c14fccd0d",
"plusrnak": 44.623055,
"score": 80.439298
},
{
"_id": "59d2face384eb78b23f60d78",
"plusrnak": 36.508239,
"score": 62.644288
},
{
"_id": "59d2face70750b413d839136",
"plusrnak": 80.446665,
"score": 44.639681
},
{
"_id": "59d2facee507560951445e3d",
"plusrnak": 60.84082,
"score": 38.997843
},
{
"_id": "59d2face415b1ba891dfbb97",
"plusrnak": 6.225893,
"score": 38.279674
},
{
"_id": "59d2facec792d7ff7ade6620",
"plusrnak": 76.954612,
"score": 23.405887
},
{
"_id": "59d2face6958596fce9baa9a",
"plusrnak": 5.903754,
"score": 1.864721
}
]
我想在每个分数中加上字段" plusrnak"值
这样:
[
{
"_id": "59d2face70750b413d839136",
"plusrnak": 80.446665,
"score": 125.086346
},
{
"_id": "59d2face138d070c14fccd0d",
"plusrnak": 44.623055,
"score": 125.062353
},
{
"_id": "59d2facec792d7ff7ade6620",
"plusrnak": 76.954612,
"score": 100.360499
},
{
"_id": "59d2facee507560951445e3d",
"plusrnak": 60.84082,
"score": 99.838663
},
{
"_id": "59d2face384eb78b23f60d78",
"plusrnak": 36.508239,
"score": 99.152527
},
{
"_id": "59d2face415b1ba891dfbb97",
"plusrnak": 6.225893,
"score": 44.505567
},
{
"_id": "59d2face6958596fce9baa9a",
"plusrnak": 5.903754,
"score": 7.768475
}
]
如何做?我可以在Config File上设置此吗?如何?
或我可以使用" plusrnak"现场替换得分?如果是空或空的,则只需使用原始分数?如何做?
这篇古老的博客文章实际上很不错且阐明。[1]我通常会劝阻添加剂提升,因为您正在以不同的规模添加值(Lucene得分不归一化,并且会因查询而异,并且随着语料库的更改而有所不同)。
。以防您仍然需要增添增强功能:使用Dismax(或Edismax)和此请求参数:bf = plusrnak
来自Solr Wiki:
field
用指定名称返回字段的数字docvalues或索引值。在其最简单的(单个参数)表单中,此函数只能在单个有价值的字段上使用,并且可以使用字段的名称作为字符串来调用,或者对于大多数常规字段名称,只需自行使用字段名称即可字段(…)语法。
使用docvalues时,可以指定可选的第二个参数以选择多估字段的" min" or "
max"值。
0用于文档中没有值的文档。
更多详细信息遵循[2]
[1] https://nolanlawson.com/2012/06/02/comparing-boost-methods-in-solr/
[2] https://lucene.apache.org/solr/guide/6_6/function-queries.html#functionqueries-availablefunctions