Я пытаюсь повысить определенные типы документов Umbraco, но при просмотре счета с помощью Luke the Score 0.0035.
Я использую Lucene.net версии 2.9.4.1.
![enter image description here](https://i.stack.imgur.com/NOnqM.png)
Я пытаюсь добавить повышение с помощью события DocumentWriting
, мой код ниже, он вызывается, и я могу пройти и убедиться,правильная линия усиления достигнута:
using System;
using Examine;
using Examine.LuceneEngine;
using Examine.LuceneEngine.Providers;
using Spurs.Site.Models.Enums;
using Umbraco.Core;
namespace Spurs.Site.Infrastructure
{
public class UmbracoEvents : ApplicationEventHandler
{
public UmbracoEvents()
{
var indexer = (LuceneIndexer)ExamineManager.Instance.IndexProviderCollection["ExternalIndexer"];
indexer.DocumentWriting += Indexer_DocumentWriting;
}
private void Indexer_DocumentWriting(object sender, DocumentWritingEventArgs e)
{
string nodeTypeAlias;
var hasNodeTypeAlias = e.Fields.TryGetValue("nodeTypeAlias", out nodeTypeAlias);
if (!hasNodeTypeAlias)
return;
DocumentTypeAlias documentType = (DocumentTypeAlias)Enum.Parse(typeof(DocumentTypeAlias), nodeTypeAlias, true);
switch (documentType)
{
case DocumentTypeAlias.playerPage:
e.Document.SetBoost(1000f);
break;
case DocumentTypeAlias.fixturePage:
e.Document.SetBoost(500f);
break;
default:
e.Document.SetBoost(1f);
break;
}
}
}
}
Я должен что-то упустить, как будто e.Document.SetBoost
не сохранен.