Hi all,
I am trying to develop search functionality for a Hippo-powered website.
The key requirements are
- Pages are created and edited in the Channel Manager using containers, catalog components, etc.
- There is a search tool that returns pages whose content matches the query terms.
While solr integration very naturally indexes documents, indexing Channel Manager pages doesn’t seem to be expected behavior. Still, I was able to successfully pull the important bits of content from the workspace JCR nodes for a given page, and create a custom ContentBean to index. So far so good.
My problem is that I also need to be able to update my index when Channel Manager changes are published. I am able to capture channel manager events using the Hippo Event Bus. However, I don’t see any way to tell, during the publication event, which pages have been changed.
code snippet:
public void onHippoEvent(HippoEvent event) {
if ("channel-manager".equals(event.category()) &&
"publishMount".equals(event.action())) {
List<Node> updatedPages = ???
for (Node pageNode : updatedPages {
// SolrIndexItem is a custom class implementing
// ContentBean and designed to hold all the information
// I need from a Channel Manager page
SolrIndexItem bean = getBeanForChannelManagerPage(pageNode);
solrClient.getSolrServer().addBean(bean);
}
solrClient.getSolrServer().commit();
}
}
One option I see is re-indexing the whole channel, but I would prefer not to do that, as I see it becoming expensive if there are many Channel Manager pages
Is there a good way to obtain changed pages in the Channel Manager, or do I need to re-think my approach to the problem?