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

The comment on the change is:
shorter data-config for full-import

------------------------------------------------------------------------------
          <entity name="item" pk="ID" query="select * from item">
              <field column="ID" name="id" />
              <field column="NAME" name="name" />
-             <field column="NAME" name="nameSort" />
-             <field column="NAME" name="alphaNameSort" />
              <field column="MANU" name="manu" />
              <field column="WEIGHT" name="weight" />
              <field column="PRICE" name="price" />
@@ -157, +155 @@

              <field column="INCLUDES" name="includes" />
  
              <entity name="feature" pk="ITEM_ID" 
-                     query="select description from feature where 
item_id='${item.id}'">
+                     query="select description from feature where 
item_id='${item.ID}'">
                  <field name="features" column="description" />
              </entity>
              <entity name="item_category" pk="ITEM_ID, CATEGORY_ID"
-                     query="select category_id from item_category where 
item_id='${item.id}'">
+                     query="select category_id from item_category where 
item_id='${item.ID}'">
                  <entity name="category" pk="ID"
-                         query="select description from category where id = 
'${item_category.category_id}'">
+                         query="select description from category where id = 
'${item_category.CATEGORY_ID}'">
                      <field column="description" name="cat" />
                  </entity>
              </entity>
@@ -188, +186 @@

                      <field column="description" name="cat" />
                  </entity>
              </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:
  {{{

Reply via email to