title: The simplest Solr DIH indexing
body: <p>I'm trying to index data from a database in Solr using the DIH.</p>
  
  <p>So I have modified the two config files as follows:</p>
  
  <p><strong>solrconfig.xml</strong> :</p>
  
  <pre><code>&lt;requestHandler name="/dataimport" 
      class="org.apache.solr.handler.dataimport.DataImportHandler"&gt;
  &lt;lst name="defaults"&gt;
      &lt;str name="config"&gt;data-config.xml&lt;/str&gt;
  &lt;/lst&gt;
  &lt;/requestHandler&gt;
  </code></pre>
  
  <p><strong>data-config.xml</strong> :</p>
  
  <pre><code>&lt;dataConfig&gt;
      &lt;dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/test" user="root" password="****"/&gt;
      &lt;document&gt;
          &lt;entity name="source_scellee" query="select * from source_scellee"&gt;
          &lt;/entity&gt;
      &lt;/document&gt;
  &lt;/dataConfig&gt;
  </code></pre>
  
  <p>source_scellee being the name of my table on my test database. It contains many fields.</p>
  
  <p>Obviously, I'm trying to run nothing else than a simple test. When running <a href="http://localhost:8983/solr/dataimport?command=full-import&amp;clean=false&amp;commit=true" rel="nofollow">http://localhost:8983/solr/dataimport?command=full-import&amp;clean=false&amp;commit=true</a> I get the following <strong>result</strong> :</p>
  
  <pre><code>&lt;str name="Full Dump Started"&gt;2012-01-27 12:27:01&lt;/str&gt;&lt;str name=""&gt;Indexing completed. Added/Updated: 4 documents. Deleted 0 documents.&lt;/str&gt;&lt;str name="Committed"&gt;2012-01-27 12:27:02&lt;/str&gt;
  &lt;str name="**Total Documents Failed**"&gt;4&lt;/str&gt;
  </code></pre>
  
  <p>Besides no warning nor error on the server logs. 4 is my number of records inside table "source_scellee". But it says all documents fail.</p>
  
  <p>If I run a query from <a href="http://localhost:8983/solr/admin/" rel="nofollow">http://localhost:8983/solr/admin/</a>
  no results appear, at all !! How can I solve it ?
  ("<em>:</em>" shows no results)</p>
  
  <p>Thank you for your help!!!</p>
  
  <p>----edit---
  I have added these lines to my schema.xml :</p>
  
  <pre><code>&lt;field name="ID" type="int" indexed="true" stored="true" /&gt;
      &lt;field name="reference_catalogue"  type="string" indexed="true" stored="true"/&gt;
      &lt;field name="reference_capsule"  type="string" indexed="true" stored="true"/&gt;
      &lt;field name="organisme_certificateur"  type="string" indexed="true" stored="true" /&gt;
      &lt;field name="reference_certificat"  type="string" indexed="true" stored="true" /&gt;
      &lt;field name="duree_d_utilisation"  type="string" indexed="true" stored="true" /&gt;
      &lt;field name="activite_nominale"   type="string" indexed="true" stored="true"/&gt;
      &lt;field name="activite_minimale"   type="string" indexed="true" stored="true"/&gt;
      &lt;field name="activite_maximale"   type="string" indexed="true" stored="true"/&gt;
      &lt;field name="coffret"  type="boolean" indexed="true" stored="true"/&gt;
      &lt;field name="dispositif_medical"  type="boolean" indexed="true" stored="true"/&gt;
      &lt;field name="forme_speciale" type="boolean" indexed="true" stored="true" /&gt;
      &lt;field name="exemption_cpa"  type="boolean" indexed="true" stored="true"/&gt;
      &lt;field name="marquage_ce"  type="boolean" indexed="true" stored="true"/&gt;
      &lt;field name="element_cible"  type="boolean" indexed="true" stored="true"/&gt;
  </code></pre>
  
  <p>However the result is still the same: no results when querying (I tried to restart solr, and to re-index all also)</p>
  
  <p>------second edit---
  I have tried the dynamic import
  Now my <strong>data-config.xml</strong> looks like this :</p>
  
  <pre><code>&lt;document&gt;
         &lt;entity name="source_scellee" query="select * from source_scellee"&gt;
              &lt;field column="ID" name="ID_i" /&gt;
              &lt;field column="reference_catalogue" name="reference_catalogue_s" /&gt;
              &lt;field column="reference_capsule" name="reference_capsule_s" /&gt;
              &lt;field column="organisme_certificateur" name="organisme_certificateur_s" /&gt;
              &lt;field column="reference_certificat" name="reference_certificat_s" /&gt;
              &lt;field column="duree_d_utilisation" name="duree_d_utilisation_s" /&gt;
              &lt;field column="activite_nominale" name="activite_nominale_s" /&gt;
              &lt;field column="activite_minimale" name="activite_minimale_s" /&gt;
              &lt;field column="activite_maximale" name="activite_maximale_s" /&gt;
              &lt;field column="coffret" name="coffret_b" /&gt;
              &lt;field column="dispositif_medical" name="dispositif_medical_b" /&gt;
              &lt;field column="forme_speciale" name="forme_speciale_b" /&gt;
              &lt;field column="exemption_cpa" name="exemption_cpa_b" /&gt;
              &lt;field column="marquage_ce" name="marquage_ce_b" /&gt;
              &lt;field column="element_cible" name="element_cible_b" /&gt;
          &lt;/entity&gt;
      &lt;/document&gt;
  </code></pre>