Sitefinity 新文档 SetBoost

Sitefinity new Document SetBoost

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

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

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