Hi Matthias, you should use <entity-name>.<column-name> in your expressions. So for example, here
WHERE fb.EBI_NR='${firma.firma_ebi_nr}' should be WHERE fb.EBI_NR='${firma.EBI_NR}' Best, Andrea 2015-10-16 13:40 GMT+02:00 Matthias Fischer <matthias.fisc...@doubleslash.de >: > Hello everybody, > > I am trying to import from an Oracle DB 11g2 via DIH using SOLR 5.3.1. > In my relational DB there are company addresses (table tb_firmen_adressen) > and branches (table tb_branchen). They have an n:m relationship using the > join table tb_firmen_branchen. > Now I would like to find companies by their name and in each company > result I would like to see the associated branches. > However I only get the companies without the nested entries. As a newbie > I'd highly appreciate some help as there are no errors or warnings in the > log file and I could not find any helpful hints in the documentation or > elsewhere in the internet concerning my problem. > > Here is my data config: > > <dataConfig> > <dataSource name="jdbc" driver="oracle.jdbc.driver.OracleDriver" > url="jdbc:oracle:thin:@//xxxxx.xxxxxxx:1521/pde11" user="myuser" > password="mysecret"/> > <document> > <entity name="firma" pk="fa.EBI_NR" query=" > SELECT fa.EBI_NR, fa.NAMENSZEILE_1, fa.NAMENSZEILE_2, > fa.NAMENSZEILE_3 > FROM tb_firmen_adressen fa > WHERE rownum < 10000 > "> > > <field name="firma_ebi_nr" column="EBI_NR" /> > <field name="firma_namenszeile_1" column="NAMENSZEILE_1" /> > <field name="firma_namenszeile_2" column="NAMENSZEILE_2" /> > <field name="firma_namenszeile_3" column="NAMENSZEILE_3" /> > > <entity name="firma_branche" child="true" query=" > SELECT b.EBC_CODE AS EBC_CODE > FROM > tb_firmen_branchen fb > JOIN tb_branchen b ON fb.EBC_CODE = b.EBC_CODE > WHERE fb.EBI_NR='${firma.firma_ebi_nr}' > "> > <field name="branche_ebc_code" column="EBC_CODE" /> > <!-- I would like to add more fields later here once I get > it to work --> > </entity> > > </entity> > </document> > </dataConfig> > > > And here are the relevant lines from my schema file: > > <uniqueKey>firma_ebi_nr</uniqueKey> > > <field name="firma_ebi_nr" type="long" > required="true" indexed="true" stored="true"/> > <field name="firma_namenszeile_1" type="text_general" > indexed="true" stored="true"/> > <field name="firma_namenszeile_2" type="text_general" > indexed="true" stored="true"/> > <field name="firma_namenszeile_3" type="text_general" > indexed="true" stored="true"/> > <field name="branche_ebc_code" type="long" > indexed="true" stored="true"/> > > > > After restarting solr and calling > http://localhost:8983/solr/jcg/dataimport?command=full-import I get > "Indexing completed. Added/Updated: 9999 documents. Deleted 0 documents." > So basically it seams to work, but my search results look like this: > > { > "responseHeader":{ > "status":0, > "QTime":71, > "params":{ > "q":"Der Bunte", > "defType":"edismax", > "indent":"true", > "qf":"firma_namenszeile_1", > "wt":"json"}}, > "response":{"numFound":85,"start":0,"docs":[ > { > "firma_ebi_nr":123123123, > "firma_namenszeile_1":"Der Bunte Laden", > "_version_":1515185579421073408}, > { > ... > } > > Why are there no company branches inside the company records? What's wrong > with my configuration? Any help is appreciated! > > Kind regards > Matthias Fischer > >