Extending Examine by canceling the GatheringNodeData event
I'm working on a project that is using Umbraco containing two websites. I want to make a search for one of the sites that is not indexing the other website. I've created the extension showed below.
On the GatherNodeData event my extension comes in
I check if I'm dealing with Content and if the path attibute is present
With my custom Helper I only check if the NodeTypeAlias name mathes "CorporateHome" in the path
If it isn't I cancel the event
Here comes the big question:
When I cancel the GatherNodeData event is this only for the current node or the whole proces of indexing?
public class CancelIndexerOnNonCorporateContent : ApplicationBase { /// <summary> /// Initializes a new instance of the <see cref="CancelIndexerOnWoningWebsite"/> class. /// </summary> public CancelIndexerOnNonCorporateContent() { ExamineManager.Instance.IndexProviderCollection["CorporateContentIndexer"].GatheringNodeData += CancelIndexerOnNonCorporateContent_GatheringNodeData; }
/// <summary> /// Handles the GatheringNodeData event of the CancelIndexerOnNonCorporateContent control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Examine.IndexingNodeDataEventArgs"/> instance containing the event data.</param> private void CancelIndexerOnNonCorporateContent_GatheringNodeData(object sender, IndexingNodeDataEventArgs e) { if (e.IndexType == "Content" && e.Node.Attribute("path") != null) { string[] pathIds = e.Node.Attribute("path").Value.Split(','); bool isInCorporatePath = pathIds.Where(i => UmbracoHelper.GetNodeTypeAlias(Convert.ToInt32(i)) == "CorporateHome").Any();
if (!isInCorporatePath) { e.Cancel = true; } } } }
Extending Examine by canceling the GatheringNodeData event
I'm working on a project that is using Umbraco containing two websites. I want to make a search for one of the sites that is not indexing the other website. I've created the extension showed below.
Here comes the big question:
When I cancel the GatherNodeData event is this only for the current node or the whole proces of indexing?
is working on a reply...