GetActualCurrentNode() Null When Re-Indexing

Posted by Community Admin on 04-Aug-2018 19:55

GetActualCurrentNode() Null When Re-Indexing

All Replies

Posted by Community Admin on 07-Jul-2011 00:00

In our pages, we have several UserControls that we've created that call SiteMapBase.GetActualCurrentNode() when rendering. They use the node path to identify and pull content items from a custom module we've created,  and then display some property information from those content items (mostly name/address information). This code works just fine both front-end and back-end. However, when we re-index the search index we've set up, GetActualCurrentNode() always returns null whenever the spider tries to load the control.

We need the content generated by these controls to be rendered and included when the pages are indexed. Is there a way around this?

Thanks.

Posted by Community Admin on 07-Jul-2011 00:00

Hello Riley,

The only way is to escape the code that uses GetActualCurrentNode, because in index mode it is null. With the current implementation if the index fails its stops, so all other pages won't be indexed.

if(page.Items["IsInIndexMode"] == null)



We are making changes in the API for Q2 which will catch the error internally, log it and the index keep working.

Best wishes,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 07-Jul-2011 00:00

Thanks for the reply.

We've dealt with the error by coding around it, as you've said. Still, this means that no content rendered by controls that depend upon GetActualCurrentNode() can ever be indexed by the search. It would seem that this is could be a pretty serious drawback for developers creating custom modules and controls that tie pages to custom content together.

For example, we have a custom module that stores restaurant information (name, location, hours of operation, contact info, etc), and have pages in the site structure for each. Usercontrols figure out which page node we're looking at based on GetActualCurrentNode(), load the correct restaurant from our module based on the node path, and render all that info from the module directly to the page. Unfortunately, the limitation you've described with GetActualCurrentNode() means that none of that info will ever be rendered for the search crawler to index it.

We'll keep looking for workarounds. Any chance you can get GetActualCurrentNode() working in index mode in a future release?

Posted by Community Admin on 08-Jul-2011 00:00

Hi Riley,

The crawler gets all HTML from the page, so there should not be not indexed data. If you have exposed a pages on which your custom module data is stored then, it will be indexed. After refactoring the API for Q2 you will be able to crate a custom pipe for your modules, so you will be able to control what the index will include.

Regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed