lucene内置的评分函数

For multiterm queries, Lucene takes the Boolean modelTF/IDF, and the vector space model and combines them in a single efficient package that collects matching documents and scores them as it goes.

A multiterm query like

GET /my_index/doc/_search { "query": { "match": { "text": "quick fox" } } }

As soon as a document matches a query, Lucene calculates its score for that query, combining the scores of each matching term. The formula used for scoring is called the practical scoring function. 

score(q,d)  =  

            queryNorm(q)  

          · coord(q,d)    

          · ∑ (           

                tf(t in d)   

              · idf(t)²      

              · t.getBoost() 

              · norm(t,d)    

            ) (t in q)    

score(q,d) is the relevance score of document d for query q.

queryNorm(q) is the query normalization factor (new).

coord(q,d) is the coordination factor (new).

 

The sum of the weights for each term t in the query q for document d.

tf(t in d) is the term frequency for term t in document d.

idf(t) is the inverse document frequency for term t.

t.getBoost() is the boost that has been applied to the query (new).

norm(t,d) is the field-length norm, combined with the index-time field-level boost, if any. (new). 官方不推荐用index-time find level

You should recognize scoretf, and idf. The queryNormcoordt.getBoost, and norm are new.

We will talk more about query-time boosting later in this chapter, but first let’s get query normalization, coordination, and index-time field-level boosting out of the way.

Query Normalization Factor

queryNorm = 1 / √sumOfSquaredWeights 

The sumOfSquaredWeights is calculated by adding together the IDF of each term in the query, squared.

The same query normalization factor is applied to every document, and you have no way of changing it. For all intents and purposes, it can be ignored. (每个文档都有这个因子,说明它没有什么卵用!)

Query Coordination

The coordination factor (coord) is used to reward documents that contain a higher percentage of the query terms. The more query terms that appear in the document, the greater the chances that the document is a good match for the query.

The coordination factor results in the document that contains all three terms being much more relevant than the document that contains just two of them.

转载于:https://www.cnblogs.com/bonelee/p/6475880.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值