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 NoblePaul:
http://wiki.apache.org/solr/DataImportHandler

------------------------------------------------------------------------------
  <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="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="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 name="category" query="select description as cat from 
category where id = '${item_category.CATEGORY_ID}'"/>                
              </entity>
          </entity>
      </document>
@@ -606, +606 @@

   * The end output of each entity is combined together to construct a document
     * Note that the intermediate rows from C i.e `C.1, C.2, f(C.1) , f(C1)` 
are ignored
  
+ == What is a row? ==
+ A row in !DataImportHandler is a Map (Map<String, Object). In the map , the 
key is the name of the field and the value can be anything which is a valid 
Solr type. The value can also be a Collection of the valid Solr types (this may 
get mapped to a multi-valued field). If the DataSource is RDBMS a query cannot 
emit a multivalued field. But it is possible to create a multivalued field by 
joining an entity with another.i.e if the sub-entity returns multiple rows for 
one row from parent entity it can go into a multivalued field. If the 
datadource is xml it is possible to return a multivalued field.
+ 
+ == A VariableResolver ==
+ A !VariableResolver is the component which replaces all those placholders 
such as `${<name>}`. It is a multilevel Map .Each namespace is a Map and 
namespaces are separated by periods (.) . eg if there is a placeholder 
${item.ID} , 'item' is a nampespace (which is a map) and 'ID' is a value in 
that namespace. It is possible to nest namespaces like ${item.x.ID} where x 
could be another Map. A reference to the current !VariableResolver can be 
obtained from the Context. Or the object can be directly consumed by using 
${<name>} in 'query' for RDMS queries or 'url' in Http .
+ 
+ 
  
  = Where to find it? =
  DataImportHandler is not in SOLR right now. You can either:

Reply via email to