Re: Coveo for Sitecore 4.0 & HtmlContentInBodyWithRequestsProcessor update
We have Sitecore items for which we want to use HtmlContentInBodyWithRequestsProcessor but these items are not viewable by anonymous users.
We discovered this ideas page https://coveo.ideas.aha.io/ideas/CID-I-306 with a Mar 7 2016 comment suggesting the http client approach is being dropped.
- Will this solve our problem, i.e. allow for indexing of html sitecore-rendered items behind security (any limitations?)
- What is status, eta?
- Is there any possibility that the approach/code could be shared with us for sooner use?
As an aside, we seem to have found code samples to have sitecore render an item as html via its own pipeline, but all of these approaches seem to require an httpcontext which isn't present in the coveoPostItemProcessingPipeline.
The HtmlContentInBodyWithRequestsProcessor processor is still the OOTB approach, and dropping this approach has been indeed investigated (by myself during a hackathon). The code is not yet working and is still in a POC state. It is not planned on attacking this issue in the near futur.
To answer your questions:
- This would index HTML content of protected items. There are bad side-effects to consider: let's say you are indexing a public LINQ based search page which queries using securities. Protected items could show up in public quickviews.
- As I mentioned above, the POC code is not yet working, The C4SC team is not working on it.
I was looking at the ItemWebApi which is not enabled by default in Sitecore. This API has a call to retrieve an item's HTML content "GetRenderingHtml". Having an OOTB processor that uses this API is not the best way to proceed => the processor would need to handle security, the API is not enabled by default, etc. (you could try this approach if you want to).
I decompiled Sitecore dlls to see how it works behind the scenes: the code runs the "getRenderingPreview" pipeline. This is what I have been trying to call in my code.
There are quite some steps to do in the processor:
- You need the Sitecore DB which contains your item. (you have the indexableItem in the arguments, args.Item.Item returns the Sitecore Item, args.Item.Item.Database returns the Sitecore DB).
- Language matters (args.Item.Item.Language returns it).
- You need to retrieve the rendering item, if any. (args.Item.Item.Visualization.GetRenderings(DEVICE, false(?))) ??? .RenderingID.ToString() (language goes in there somewhere). (DEVICE is a Sitecore device (I would try using the default device (Don't know how to retrieve it => use google :-) ))).
- Then, you can build the pipeline arguments + run the pipeline.
- set the data (p_Args.CoveoItem.BinaryData = GetBytes(renderingPreviewArgs.Result); ???)
- does it works MVC + webform?
- is the retrieved data similar/same as what is being retrieved by the HtmlContentInBodyWithRequestsProcessor processor.
- undesired side-effects?
- improved indexing performances: much faster doing such a thing than performing REST calls.
If you do try to implement this, sharing the code with us would be appreciated + you might get it OOTB faster.