简体   繁体   English

如何在 Solr.Net 中实现恒定评分?

[英]How to implement constant scoring in Solr.Net?

I have a SOLR query which I want to assign a constant score to.我有一个 SOLR 查询,我想为其分配一个恒定分数。 How do I do that using SOLR.Net?我如何使用 SOLR.Net 做到这一点?

Example of query:查询示例:

(x_type_s:("Person") AND _query_:("{!type=parent which=x_type_s:Person}((path_s:Facets.Emails AND email_s:testaccount@sgmail.com)^=1)"))

I know SOLR.Net allows Local params to set parent queries but I found nothing to implement constant scoring.我知道 SOLR.Net 允许本地参数设置父查询,但我发现没有实现持续评分。

Constant Score with ^=使用 ^= 的恒定分数

There is a concept of Constant Score queries in Solr which will only look for a match and do not impact the document score. Solr 中有一个恒定分数查询的概念,它只会查找匹配项,不会影响文档分数。 In your query, you have already used the constant score clause but for nested query.在您的查询中,您已经使用了常量分数子句,但用于嵌套查询。 How about if you enclosed the whole query inside constant query clause.如果将整个查询包含在常量查询子句中怎么样。

(x_type_s:("Person") AND _query_:("{!type=parent which=x_type_s:Person}((path_s:Facets.Emails AND email_s:testaccount@sgmail.com)^=1)"))^=1

From the solr documentation来自 solr 文档

Constant score queries are created with ^=, which sets the entire clause to the specified score for any documents matching that clause.使用 ^= 创建常量分数查询,它将整个子句设置为与该子句匹配的任何文档的指定分数。 This is desirable when you only care about matches for a particular clause and don't want other relevancy factors such as term frequency (the number of times the term appears in the field) or inverse document frequency (a measure across the whole index for how rare a term is in a field).当您只关心特定子句的匹配并且不希望其他相关因素(例如术语频率(术语在字段中出现的次数)或逆文档频率(整个索引的衡量标准)时,这是可取的很少有一个术语在一个领域)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM