Hello,
I am trying to write a data service using SolrJ that will allow me to
accept JSON through a REST API, create a Solr document ,and write it to
multiple different Solr cores (depending on the core name specified). The
problem I am running into is that each core is going to have a different
schema. My current code has the common fields between all the schemas in a
data POJO which I then walk and set the values specified in the JSON to the
Solr Document. However, I don’t want to create a different class for each
schema to process the JSON and convert it to a Solr Document. Is there a
way to process the extra JSON fields that are not common between the
schemas and add them to the Solr Document, without knowing what they are
ahead of time? Is there a way to convert JSON to a Solr Document without
having to use a POJO?  An alternative I was looking into is to use the
SolrClient to get the schema fields, create a POJO, walk that POJO to
create a Solr Document and then add it to Solr but, it doesn’t seem to be
possible to obtain the fields this way.

I know that the easiest way to add JSON to Solr would be to use a curl
command and send the JSON directly to Solr but this doesn’t match our
requirements, so I need to figure out a way to perform the same operation
using SolrJ. Any other ideas or suggestions would be greatly appreciated!

Thank you,

-Jennifer

Reply via email to