Sitecore Solr 搜索得分值 [英] Sitecore Solr Search Score Value

查看:26
本文介绍了Sitecore Solr 搜索得分值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取每个返回结果项的分数值,但问题是所有项都返回相同的分数值.我正在使用从 sitecore 6.6 升级的 sitecore 7.2 站点.我使用的是 solr 版本 4.10.2-0

I am trying to get the score value for each returned result item but the problem is all items returned the same score value. I am using sitecore 7.2 site which was upgraded from sitecore 6.6. I am using solr version 4.10.2-0

以下是我使用的代码:

var contentPredicate = PredicateBuilder.True<customSearchResultItem>();
contentPredicate = contentPredicate.And(p => p.Content.Matches(SearchKey.Boost(1.0f)));

IQueryable<SearchResultItem> query = context.GetQueryable<customSearchResultItem>().Where(contentPredicate);

var hits =  query.GetResults().Hits;

foreach (var item in hits)
{
    scores.Add(item.Score);
}

如果有什么遗漏,你能告诉我吗?或者是否应该应用任何配置来使其工作?

Would you please advise if something is missing? or if there are any configuration that should be applied to make this work?

推荐答案

应存在以下内容以应用 boosting 功能并相应地对项目进行排序:

The following should be exist to apply boosting feature and sorting items accordingly:

  • 搜索应该有多个子句,否则检索到的项目将具有相同的分数值
  • 当搜索包含多个子句(谓词)时,它们将对分值具有相同的权重,除非应用 boost 方法.Boost(10.0f).
  • 子句之间的组合应该是OR",否则返回的项目必须匹配所有要检索的谓词,这意味着相同的分数值.

这篇关于Sitecore Solr 搜索得分值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆