Can I pass a SQL result value to SolrEntityProcessor inside a single Entity?

47 Views Asked by At

I have a SQL table that stores Solr queries. I want to have a Solr collection that contains documents "stamped" with those Solr queries.

For example, I have a document in a RawDataCollection:

{
  "id":"1_01",
  "ContentType":"chapter",
  "Title":"A Long-expected Party",
  "book":1,
  "chapter":1
}

And a SolrQueries SQL record:

StampText       | SolrQuery  
----------------+-----------------------------------  
IsFirstChapter  | ContentType:chapter AND chapter:1

I want a document to be indexed into a MetaDataCollection like so:

{
  "id":"1_01",
  "IsFirstChapter":true
}

Now, to accomplish this I know I need to do this:

  1. Query the database for the SolrQueries records
  2. Query Solr using those records' SolrQuery values
  3. Upsert metadata documents with the StampText values

My current idea is to use the default SQLServerDriver to get the SolrQueries records, then pass the result to the SolrEntityProcessor. I found this question on SO, but I don't want a separate Entity for each SQL record. Can I accomplish this with a single Entity?

0

There are 0 best solutions below