Sitefinity 新文档 SetBoost
我正在收集外部数据,然后执行 ServiceBus.ResolveService
。这工作得很好,但我想在新文档
上SetBoost
。我使用 doc.SetBoost(1.5f); 创建了一个标志 setboost,但出现运行时错误。这是设置提升分数的正确方法吗?
严重性代码描述项目文件行抑制状态抑制状态 错误 CS1061“文档”不包含“SetBoost”的定义,并且找不到接受“文档”类型的第一个参数的可访问扩展方法“SetBoost”(您是否缺少 using 指令或程序集引用?)\
public static void ExternalIndexerAdd(ExternalIndexModel externalIndexer,boolean setBoost)
{
try
{
var fields = new List<IField>();
var identityFld = new Field();
identityFld.Name = "IdentityField";
identityFld.Value = externalIndexer.IdentityField;
fields.Add(identityFld);
var titleField = new Field();
titleField.Name = "Title";
titleField.Value = externalIndexer.TitleField;
fields.Add(titleField);
var contentField = new Field();
contentField.Name = "Content";
contentField.Value = externalIndexer.ContentField;
fields.Add(contentField);
var linkField = new Field();
linkField.Name = "Link";
linkField.Value = externalIndexer.LinkField;
fields.Add(linkField);
var lastModifiedField = new Field();
lastModifiedField.Name = "LastModified";
lastModifiedField.Value = externalIndexer.LastModifiedField;
fields.Add(lastModifiedField);
var doc = new Document(fields, String.Format("{0}", "IdentityField"));
if (SetBoost == true){
doc.SetBoost(1.5f);
}
ServiceBus.ResolveService<ISearchService>().UpdateIndex("nccn-search-index", new List<IDocument>() { doc });
}
catch (Exception ex)
{
}
}
I am collecting external data and then doing an ServiceBus.ResolveService<ISearchService>().UpdateIndex
. This is working great but I wanted to SetBoost
on the new Document
. I have created an flag setboost with is using doc.SetBoost(1.5f);
but I am getting a runtime error. Is this the correct way to set the boost score?
Severity Code Description Project File Line Suppression State Suppression State
Error CS1061 'Document' does not contain a definition for 'SetBoost' and no accessible extension method 'SetBoost' accepting a first argument of type 'Document' could be found (are you missing a using directive or an assembly reference?)\
public static void ExternalIndexerAdd(ExternalIndexModel externalIndexer,boolean setBoost)
{
try
{
var fields = new List<IField>();
var identityFld = new Field();
identityFld.Name = "IdentityField";
identityFld.Value = externalIndexer.IdentityField;
fields.Add(identityFld);
var titleField = new Field();
titleField.Name = "Title";
titleField.Value = externalIndexer.TitleField;
fields.Add(titleField);
var contentField = new Field();
contentField.Name = "Content";
contentField.Value = externalIndexer.ContentField;
fields.Add(contentField);
var linkField = new Field();
linkField.Name = "Link";
linkField.Value = externalIndexer.LinkField;
fields.Add(linkField);
var lastModifiedField = new Field();
lastModifiedField.Name = "LastModified";
lastModifiedField.Value = externalIndexer.LastModifiedField;
fields.Add(lastModifiedField);
var doc = new Document(fields, String.Format("{0}", "IdentityField"));
if (SetBoost == true){
doc.SetBoost(1.5f);
}
ServiceBus.ResolveService<ISearchService>().UpdateIndex("nccn-search-index", new List<IDocument>() { doc });
}
catch (Exception ex)
{
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了实现这一目标,我相信您将需要自定义 Sitefinity 的 lucene 搜索索引的搜索评分。以下是可用的搜索 API:https ://www.progress.com/documentation/sitefinity-cms/for-developers-customize-the-lucene-search-scoring
In order to accomplish this I believe you will need to customize the search scoring of Sitefinity's lucene search index. Here is the search API available: https://www.progress.com/documentation/sitefinity-cms/for-developers-customize-the-lucene-search-scoring