Search: Manually running the search indexer - akumina/AkuminaTraining GitHub Wiki
Applies to
Akumina Foundation 3.4 and later
Overview
As the SharePoint search indexer does not index rendered content rendered via Javascript on the page, we use an indexer that will add the rendered page content to a list, which we then search. This indexer is a page life cycle step and the functionality can be overridden to accommodate the following use cases:
- Altering the timing of the index call.
- Running your own index function.
Turn off the default indexer
The indexer step is located at CoreSteps.IndexPageData and runs as one of the last steps in the page life cycle. To turn off this step, you will need to set the following step to false:
Akumina.Digispace.ConfigurationContext.CONSTANTS.LOADER_STEPS_ENABLE_INDEXPAGEDATA = false
Run the indexer manually
To run the index function manually, use the followng JavaScript function:
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', CoreSteps.IndexPageData.IndexPage);
An extended example, which shows how to run the Indexer when the Virtual Page is rendered:
if (Akumina.Digispace.SiteContext.IsVirtualPage){
// subscribe to the virtual page load function.
Akumina.Digispace.AppPart.Eventing.Subscribe("/page/render/", window.OnPageRenderHandler);
}
window.OnPageRenderHandler = function () {
CoreSteps.IndexPageData.IndexPage();
};