We have a custom ExamineManager.Instance.IndexProviderCollection["SomeIndexer"].NodeIndexing event handler to exlude certain items from the index. We have noticed that it doesn't fire when you rebuild an index from scratch.
When you say custom you mean you have created your indexer based on SimpleDataIndexer or you have created your own umbraco index? Also one thing you do not need gatheringnode data to exclude certain node types you can do it in the examine config file.
It's not exclusion based on a node type it's custom exclusion based on the value of a property in the document.
This is not a custom indexer, I am simply attaching to the event on our website index, this is a separate index to the umbraco media, member and internal indexes.
Ok makes sense. So if definately fires when you publish just one page? What version of umbraco are you using and can post the code for the event i just want to see how you are doing it.
Thanks to the question from Ismail, I looked into the event ordering in 6.1.6.
I believe this is caused by the fact that we need to update our code to implement IApplicationEventHandler and hook into the initialise event to register the node indexing handlers early enough in the startup chain.
NodeIndexing doesn't fire on index rebuild
We have a custom ExamineManager.Instance.IndexProviderCollection["SomeIndexer"].NodeIndexing event handler to exlude certain items from the index. We have noticed that it doesn't fire when you rebuild an index from scratch.
Any ideas why this is?
Cheers,
Ed
Ed,
When you say custom you mean you have created your indexer based on SimpleDataIndexer or you have created your own umbraco index? Also one thing you do not need gatheringnode data to exclude certain node types you can do it in the examine config file.
Regards
Ismail
Hi Ismail,
It's not exclusion based on a node type it's custom exclusion based on the value of a property in the document.
This is not a custom indexer, I am simply attaching to the event on our website index, this is a separate index to the umbraco media, member and internal indexes.
Cheers,
Ed
Ed,
Ok makes sense. So if definately fires when you publish just one page? What version of umbraco are you using and can post the code for the event i just want to see how you are doing it.
Cheers
Ismail
Version 6.1.6, upgraded from 4.7.1.1.
private const string notApprovedFieldKey = "notApproved";
{
bool cancel = false;
if (string.Compare(e.IndexType, IndexTypes.Content, StringComparison.OrdinalIgnoreCase) == 0)
{
if ((!e.Fields.ContainsKey("title") || string.IsNullOrWhiteSpace(e.Fields["title"]))
|| (e.Fields.ContainsKey("umbracoNaviHide") && string.Compare(e.Fields["umbracoNaviHide"], "1", StringComparison.OrdinalIgnoreCase) == 0)
|| (e.Fields.ContainsKey("template") && string.Compare(e.Fields["template"], "0", StringComparison.OrdinalIgnoreCase) == 0))
{
cancel = true;
}
else
{
if (e.Fields.ContainsKey(notApprovedFieldKey) && string.Compare(e.Fields[notApprovedFieldKey], "1", StringComparison.OrdinalIgnoreCase) == 0)
{
cancel = true;
}
else
{
if (e.Fields.ContainsKey(parentIdFieldKey) && string.Compare(e.Fields[parentIdFieldKey], "-1", StringComparison.OrdinalIgnoreCase) != 0)
{
cancel = IsParentNotApproved(e.Fields[parentIdFieldKey]);
}
}
}
}
e.Cancel = cancel;
}
Cheers,
Ed
Ed,
Which base class are you inheriting from?
Regards
Ismail
Ismail,
umbraco.BusinessLogic.ApplicationBase
I am aware that this is obsolete in the latest version of Umbraco but we haven't had a chance to upgrade it yet.
Cheers,
Ed
Thanks to the question from Ismail, I looked into the event ordering in 6.1.6.
I believe this is caused by the fact that we need to update our code to implement IApplicationEventHandler and hook into the initialise event to register the node indexing handlers early enough in the startup chain.
Cheers,
Ed
is working on a reply...