My requirement is to get the data in XML/JSON format from a third party service and to update to Solr using SI4T programmatically (.Net code). Please let me know is there anyway to do this? Thanks in advance.
2 Answers
My understanding of SI4T is that the index data is appended as comment in the rendering phase to the rendered (Page) output, and on the CD side, this is (from a storage extension):
- Sent to indexing to Solr (or some other system)
- Stripped from the received output and persisted without it into the Content Data Store (Broker or filesystem).
Having this in mind, I don't see how you can circumvent the entire publishing phase and use SI4T directly. It is an extension and as such it is integrated into the publishing pipeline.
The only thing that comes to mind is creating dummy Deployer packages with the indexed data, but I strongly advice against this. You would need to make sure to pair the data to something (a dummy page for example), keep in mind that that something will get deployed etc. It's a big hack, and an awful one at that!
Now, you could also take the route that SI4T is open source and rewrite it so that you can call it directly. But that way it won't be an extension as originally envisioned, but some proxy service. And in that case, why not just communicate to Solr directly :)
You have two choices:
Get the XML data into Solr without passing it through the CMS. In this case SI4T no longer plays a role (even the indexer would not be particularly helpful as a code example as it is Java and not .NET) your question becomes something for a Solr forum and doesnt really belong here.
Read the XML data as part of the publishing process from a Tridion TBB. In which case you would call your API when publishing something from the CMS, and add it to the SI4T indexing data for the published page or dynamic component presentation. See the Custom Indexing Logic section at the end of this page on the SI4T wiki: https://github.com/SI4T/SI4T/wiki/Configuring-Templates-:-What-Gets-Indexed%3F