我希望我的搜索结果按得分订购,但是得分的计算不当。这就是说,不一定是 不当, ,但与预期不同,我不确定为什么。我的目标是删除改变分数的任何内容。

如果我执行匹配两个对象的搜索(其中预期对objecta的分数将比对象b高),则首先返回对象b。

假设我的查询是一个术语:“苹果”。

Objecta的标题:“苹果是苹果”(2/3项)
Objecta的描述:“苹果苹果中有苹果,现在苹果在苹果上全部苹果!” (6/18术语)
Objectb的标题:“苹果很棒”(1/3项)
Objectb的描述:“苹果房间里有苹果,现在苹果在苹果上都变得不好!” (4/18条)

标题字段没有提升(或更确切地说是提升1),并且描述字段的提升为0.8。我尚未通过solrconfig.xml或通过我通过的查询指定文档的提升。如果有另一种指定文档提升的方法,我有可能缺少一个文档。

分析后 explain 打印输出,看起来像objecta 像我想要的那样,适当地计算出比对象b更高的分数 差异:ObjectB的标题字段词总是高于Objecta。


这里是 explain 打印。只是你知道:标题字段是 mditem5_tns 描述字段是 mditem7_tns:

ObjectB:
1.3327172 = (MATCH) sum of:
  1.0352166 = (MATCH) max plus 0.1 times others of:
    0.9766194 = (MATCH) weight(mditem5_tns:appl in 0), product of:
      0.53929156 = queryWeight(mditem5_tns:appl), product of:
        1.8109303 = idf(docFreq=3, maxDocs=9)
        0.2977981 = queryNorm
      1.8109303 = (MATCH) fieldWeight(mditem5_tns:appl in 0), product of:
        1.0 = tf(termFreq(mditem5_tns:appl)=1)
        1.8109303 = idf(docFreq=3, maxDocs=9)
        1.0 = fieldNorm(field=mditem5_tns, doc=0)
    0.58597165 = (MATCH) weight(mditem7_tns:appl^0.8 in 0), product of:
      0.43143326 = queryWeight(mditem7_tns:appl^0.8), product of:
        0.8 = boost
        1.8109303 = idf(docFreq=3, maxDocs=9)
        0.2977981 = queryNorm
      1.3581977 = (MATCH) fieldWeight(mditem7_tns:appl in 0), product of:
        2.0 = tf(termFreq(mditem7_tns:appl)=4)
        1.8109303 = idf(docFreq=3, maxDocs=9)
        0.375 = fieldNorm(field=mditem7_tns, doc=0)
  0.2975006 = (MATCH) FunctionQuery(1000.0/(1.0*float(top(rord(lastmodified)))+1000.0)), product of:
    0.999001 = 1000.0/(1.0*float(1)+1000.0)
    1.0 = boost
    0.2977981 = queryNorm

ObjectA:
1.2324848 = (MATCH) sum of:
  0.93498427 = (MATCH) max plus 0.1 times others of:
    0.8632177 = (MATCH) weight(mditem5_tns:appl in 0), product of:
      0.53929156 = queryWeight(mditem5_tns:appl), product of:
        1.8109303 = idf(docFreq=3, maxDocs=9)
        0.2977981 = queryNorm
      1.6006513 = (MATCH) fieldWeight(mditem5_tns:appl in 0), product of:
        1.4142135 = tf(termFreq(mditem5_tns:appl)=2)
        1.8109303 = idf(docFreq=3, maxDocs=9)
        0.625 = fieldNorm(field=mditem5_tns, doc=0)
    0.7176658 = (MATCH) weight(mditem7_tns:appl^0.8 in 0), product of:
      0.43143326 = queryWeight(mditem7_tns:appl^0.8), product of:
        0.8 = boost
        1.8109303 = idf(docFreq=3, maxDocs=9)
        0.2977981 = queryNorm
      1.6634457 = (MATCH) fieldWeight(mditem7_tns:appl in 0), product of:
        2.4494898 = tf(termFreq(mditem7_tns:appl)=6)
        1.8109303 = idf(docFreq=3, maxDocs=9)
        0.375 = fieldNorm(field=mditem7_tns, doc=0)
  0.2975006 = (MATCH) FunctionQuery(1000.0/(1.0*float(top(rord(lastmodified)))+1000.0)), product of:
    0.999001 = 1000.0/(1.0*float(1)+1000.0)
    1.0 = boost
    0.2977981 = queryNorm
有帮助吗?

解决方案

问题是由Stemmer引起的。它将“苹果是苹果”扩展到“苹果appl apples appl”,从而使场更长。由于文档B仅包含1个术语。

这会导致不同的现场点。

其他提示

FieldNorm计算由3个组件计算 - 在现场上的索引时间增强,在文档和场长上进行了index-time增强。假设您没有提供任何索引时间提升,则差异必须是字段长度。

因此,由于对于较短的字段值而言,要使标题具有较高的字段词值,因此lentnorm必须具有较高的字段词值,因此标题中必须具有较少的令牌。

有关Lucene评分的详细说明,请参见以下页面:

http://lucene.apache.org/java/2_4_0/scoring.html http://lucene.apache.org/java/2_4_0/api/org/opache/lucene/search/similarity.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top