Solr Json URLDataSource
Solr DataImportHandler documentation says we could index data from other Solr servers using URLDat开发者_如何学CaSource. Can anyone please guide me how to produce a data config file for that purpose?
For instance, I have a Solr server (call it Server A) that returns items as Json. A query for item_id ABCD-1234 produces a result like this:
{
"responseHeader":{
"status":0,
"QTime":2,
"params":{
"indent":"on",
"start":"0",
"q":"item_id:ABCD-123",
"wt":"json",
"rows":"10",
"version":"2.2"}},
"response":{"numFound":2,"start":0,"docs":[
{
"region":"NE",
"edit_date":"2007-12-12T05:00:00Z",
"market":"USA",
"item_type":"Q",
"item_id":"ABCD-1234"},
{
"region":"NW",
"edit_date":"2007-12-15T05:00:00Z",
"market":"USA",
"item_type":"Q",
"item_id":"ABCD-1234"}]
}}
If I want to index this data in a different Solr server (say Server B) through DataImportHandler, how would the data-config configuration file look like for Server B?
AFAIK, URLDataSource can only parse XML data.
If you want to use JSON format, you have to POST it to your Solr instance or try to google around to check if anyone has written a DataSource<Reader>
implementation ad hoc for your needs.
You can also specify wt=xml in your solr request url to get response in xml format
精彩评论