0

我正在收集外部数据,然后进行ServiceBus.ResolveService<ISearchService>().UpdateIndex. 这很好用,但我想SetBoostnew Document. 我已经使用 is using 创建了一个标志 setboost,doc.SetBoost(1.5f);但出现运行时错误。这是设置提升分数的正确方法吗?

严重性代码描述项目文件行抑制状态抑制状态错误 CS1061“文档”不包含“SetBoost”的定义,并且找不到接受“文档”类型的第一个参数的可访问扩展方法“SetBoost”(您是否缺少使用指令还是程序集引用?)\

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)
            {
               
            }
       }
4

1 回答 1

1

为了实现这一点,我相信您需要自定义 Sitefinity 的 lucene 搜索索引的搜索评分。这是可用的搜索 API:https ://www.progress.com/documentation/sitefinity-cms/for-developers-customize-the-lucene-search-scoring

于 2022-03-04T12:49:04.153 回答