Using examine to index a multi node picker to remove the comas.
I'm using Umbraco 7 to index a multi node picker so I can replace the coma separation with spaces.
This is the code I am using but all the default index return null.
using System;
using System.Text;
using System.Xml.Linq;
using Examine;
using umbraco.BusinessLogic;
using UmbracoExamine;
namespace Site.App_Code
{
public class ExamineEvents : ApplicationBase
{
public ExamineEvents()
{
var y = ExamineManager.Instance;
var x = ExamineManager.Instance.IndexProviderCollection["UmbracoExamine.UmbracoContentIndexer"];
var b = ExamineManager.Instance.IndexProviderCollection["ExamineLuceneIndexSets"];
var c = ExamineManager.Instance.IndexProviderCollection["InternalIndexSet"];
ExamineManager.Instance.IndexProviderCollection["ExternalIndexSet"].GatheringNodeData += ExamineEvents_GatheringNodeData;
}
void ExamineEvents_GatheringNodeData(object sender, IndexingNodeDataEventArgs e)
{
GatheringNodeDataHandler(e);
}
private void GatheringNodeDataHandler(IndexingNodeDataEventArgs e)
{
//grab the current data from the Fields collection
var mntp = e.Fields["sector"];
//let's get rid of those commas!
mntp = mntp.Replace(",", " ");
//now put it back into the Fields so we can pretend nothing happened!
e.Fields["sector"] = mntp;
}
}
}
Using examine to index a multi node picker to remove the comas.
I'm using Umbraco 7 to index a multi node picker so I can replace the coma separation with spaces.
This is the code I am using but all the default index return null.
Fixed. I just needed to use ExternalIndexer.
is working on a reply...