Frage

Ich versuche, Daten aus einer Datenbank in SolR mit dem DIH zu indexieren.

Ich habe also die beiden Konfigurationsdateien wie folgt geändert:

solrconfig.xml : generasacodicetagpre.

data-config.xml : generasacodicetagpre.

surce_scellee ist der Name meiner Tabelle in meiner Testdatenbank. Es enthält viele Felder.

Ich versuche offensichtlich, nichts anderes als einen einfachen Test auszuführen. Wenn Sie http:// localhost: 8983 / solr / catedimport? Befehl= voll -Import & clean= false & commit= true Ich erhalte das folgende Ergebnis : generasacodicetagpre.

Neben keiner Warnung oder Fehler auf den Serverprotokollen. 4 ist meine Anzahl der Datensätze in der Tabelle "source_scellee". Aber es sagt, dass alle Dokumente versagen.

Wenn ich eine Abfrage von http:// localhost: 8983 / solr / admin / Keine Ergebnisse erscheinen überhaupt !! Wie kann ich es lösen? (": " zeigt keine Ergebnisse)

Vielen Dank für Ihre Hilfe !!!

---- edit --- Ich habe diese Zeilen meinem Schema.xml hinzugefügt: generasacodicetagpre.

Das Ergebnis ist jedoch immer noch gleich: Keine Ergebnisse beim Abfragen (ich habe versucht, Solr neu zu starten und alle auch erneut zu indexieren)

------- Zweiter Bearbeitung --- Ich habe den dynamischen Import ausprobiert Jetzt sieht mein data-config.xml so aus: generasacodicetagpre.

War es hilfreich?

Lösung

1.) You can take a look to the statistics page to see, how much docs are indexed right now: http://localhost:8983/solr/admin/stats.jsp

2.) The result of your search depends on your schema.xml, because there it's defined how docs are indexed/stored, which fields are processed and how searchs are handled on query time. Please take a look at this file or post the field definition from the schema.xml and also the schema/design from your table source_scellee. Does the columns and the fields have the same name?

//Edit: This should work, if coulmname and filedname are the same:

<document>
       <entity name="source_scellee" 
               pk="ID"
               query="select * from source_scellee">

        </entity>
    </document>

is having NULL values in data an issue ?

that depends on the destination field.

Are your running solr in an tomcat or someting like that? Take a look in the Java EE Container output, like catalina.out or so.

Andere Tipps

I am pretty sure the issue lies in how the DIH is trying to map fields. Thanks for adding the information from your schema file... However, I believe that what you have done is added configuration that needs to be added separately to both the schema.xml and the data-config.xml for the DIH.

Based on the Full Import Example from the Solr Wiki, I would try the following.

schema.xml

 <field name="ID" type="int" indexed="true" stored="true" />
 <field name="reference_catalogue"  type="string" indexed="true" stored="true"/>
 <field name="reference_capsule"  type="string" indexed="true" stored="true"/>
 <field name="date_de_creation"  type="date" indexed="true" stored="true"/>
 <field name="organisme_certificateur"  type="string" indexed="true" stored="true" />
 <field name="reference_certificat"  type="string" indexed="true" stored="true" />
 <field name="duree_d_utilisation"  type="string" indexed="true" stored="true" />
 <field name="activite_nominale"   type="string" indexed="true" stored="true"/>
 <field name="activite_minimale"   type="string" indexed="true" stored="true"/>
 <field name="activite_maximale"   type="string" indexed="true" stored="true"/>
 <field name="coffret"  type="int" indexed="true" stored="true"/>
 <field name="dispositif_medical"  type="int" indexed="true" stored="true"/>
 <field name="forme_speciale" type="int" indexed="true" stored="true" />
 <field name="exemption_cpa"  type="int" indexed="true" stored="true"/>
 <field name="marquage_ce"  type="int" indexed="true" stored="true"/>
 <field name="element_cible"  type="int" indexed="true" stored="true"/>

data-config.xml

 <dataConfig>
     <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/test" user="root" password="****"/>
     <document>
         <entity name="source_scellee" query="select * from source_scellee">
           <field column="ID" name="ID"/>
           <field column="reference_catalogue" name="reference_catalogue"/>
           <field column="reference_capsule" name="reference_capsule"/>
           <field column="date_de_creation" name="date_de_creation"/>
           <field column="organisme_certificateur" name="organisme_certificateur"/>
           <field column="reference_certificat" name="reference_certificat"/>
           <field column="duree_d_utilisation" name="duree_d_utilisation"/>
           <field column="activite_nominale" name="activite_nominale"/>
           <field column="activite_minimale" name="activite_minimale"/>
           <field column="activite_maximale" name="activite_maximale"/>
           <field column="coffret" name="coffret"/>
           <field column="dispositif_medical" name="dispositif_medical"/>
           <field column="forme_speciale" name="forme_speciale"/>
           <field column="exemption_cpa" name="exemption_cpa"/>
           <field column="marquage_ce" name="marquage_ce"/>
           <field column="element_cible" name="element_cible"/>
         </entity>
     </document>
 </dataConfig>

There is a way to setup the schema.xml to dynamically add fields that it encounters by using some naming conventions. Please see the Dynamic Fields details in the Solr Wiki for more details and some examples of how this can be done.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top