Sitefinity 新文档 SetBoost

发布于 2025-01-10 14:07:01 字数 2044 浏览 1 评论 0原文

我正在收集外部数据,然后执行 ServiceBus.ResolveService().UpdateIndex。这工作得很好,但我想在新文档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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过去的过去 2025-01-17 14:07:01

为了实现这一目标,我相信您将需要自定义 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文