Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The following page has been changed by ShalinMangar: http://wiki.apache.org/solr/DataImportHandler The comment on the change is: Re-ordered section on shorter data-config, updated encoding attribute for http ------------------------------------------------------------------------------ </entity> }}} - === A shorter data-config === - In the above example , there are mappings of fields to solr fields. It is possible to totally avoid the field entries in entities if the names of the fields are same(not case-sensitive) as those in solrschema. You may need to add a field entry if any of the inbuilt tranformers are used. (see Transformer section) - - the shorter version is given below - {{{ - <dataConfig> - <document name="products"> - <entity name="item" pk="ID" query="select * from item"> - <entity name="feature" query="select description as features from feature where item_id='${item.id}'"/> - <entity name="item_category" query="select category_id from item_category where item_id='${item.id}'"> - <entity name="category" query="select description as cat from category where id = '${item_category.category_id}'"/> - </entity> - </entity> - </document> - </dataConfig> - }}} - - - * The dataimport section in ''example/solr/conf/solrconfig.xml'' in the example-solr-home you downlaoded, is as follows: + * The dataimport section in ''solr/db/conf/solrconfig.xml'' in the example-solr-home you downloaded, is as follows: {{{ <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler"> <lst name="defaults"> @@ -219, +201 @@ </lst> </lst> </requestHandler> + }}} + + === A shorter data-config === + In the above example, there are mappings of fields to Solr fields. It is possible to totally avoid the field entries in entities if the names of the fields are same (case does not matter) as those in Solr schema. You may need to add a field entry if any of the inbuilt Tranformers are used (see Transformer section) + + The shorter version is given below + {{{ + <dataConfig> + <document name="products"> + <entity name="item" pk="ID" query="select * from item"> + <entity name="feature" query="select description as features from feature where item_id='${item.id}'"/> + <entity name="item_category" query="select category_id from item_category where item_id='${item.id}'"> + <entity name="category" query="select description as cat from category where id = '${item_category.category_id}'"/> + </entity> + </entity> + </document> + </dataConfig> }}} == Using delta-import command == @@ -349, +348 @@ ''' The attributes are ''' * '''`baseUrl`''' (optional): you should use it when the host/port changes between Dev/QA/Prod environments. Using this attribute isolates the changes to be made to the solrconfig.xml - * '''`encoding`'''(optional): by default the response from the URL is read in UTF-8 encoding + * '''`encoding`'''(optional): by default the encoding in the response from the URL is used. You can use this property to override the default encoding. * '''`connectionTimeout`''' (optional):The default value is 5000ms - * '''`readTimeout`''' (optional): the default value is 10000ms + * '''`readTimeout`''' (optional): the default value is 10000ms + == Configuration in data-config.xml == The entity for an xml/http data source can have the following attributes over and above the default attributes * '''`processor`''' (required) : The value must be `"XPathEntityProcessor"` * '''`url`''' (required) : The url used to invoke the REST API. (Can be templatized) - * '''`forEach`'''(required) : The xpath expression which demarcates a record. If there are mutiple types of record separate them with ''" | "'' + * '''`forEach`'''(required) : The xpath expression which demarcates a record. If there are mutiple types of record separate them with ''" | "'' (pipe) - - The fields can have the following attributes (over and above the default attributes):
