I have this data-config.xml
<dataConfig>
<dataSource name="sql" type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://server/db"
user="user"
password="pwd"/>
<dataSource name="web" type="URLDataSource" connectionTimeout="5000" readTimeout="10000" />
<document name="doc">
<entity name="artikel" datasource="sql" query="select a.x1,a.x2,b.y1,b.y2 from tab1 a, tab2 b WHERE a.id>0 and a.x1=b.y1"
deltaImportQuery="select a.x1,a.x2,b.y1,b.y2 from tab1 a, tab2 b WHERE a.id>0 and a.x1=b.y1 id='${dataimporter.delta.job_jobs_id}' "
deltaQuery="select select a.x1,a.x2,b.y1,b.y2 from tab1 a, tab2 b WHERE a.id>0 and a.x1=b.y1 from tab1 a, tab2 b b WHERE timestamp > '${dataimporter.last_index_time}' and a.shopwgr=b.shopwgr">
<field column="x1" name="id" />
<field column="x2" name="bezeich" />
<field column="y1" name="beschr" />
<field column="y2" name="keynum" />
<entity name="artikeljson" processor="XPathEntityProcessor" forEach="/" url="http://xxx.web.de/dataimport.php" dataSource="web">
<field column="xx1" name="xx2" xpath ="/xx2" />
</entity>
</entity>
</document>
The Request from dataimport.php returns this JSON:
Array (
[0] => Array (
[xx1] => Text1
[xx2] => Text2
[keynum] => 10003
[xx3] => text3
[xx4] => Array
(
[0] => http://bildurl1.de/832500+1427507417.jpg
[1] => http://bildurl1.de/07418.jpg
)
[xx5] => 18.89
[xx6] => 0
[xx7] => 0
[xx8] => http://urlzum.de/artikel.php?id=10003
[xx9] => 3
[xx10] => 0
[xx11] => 0
[xx12] => 32122
[xx13] => 0
[xx14] => -1
[xx15] => -1
[xx16] =>
[xx17] => Array
(
[yy1] => Array
(
[0] => 10003
)
[yy2] => Array
(
[0] => 10003
)
[yy3] => Array
(
[10003] => 18.89
)
[yy4] => Array
(
[10003] => 0
)
[yy5] => 3
[yy6] => 0
)
[xx18] => 0
[xx19] => text5
[xx20] => 19
[xx21] => 3
[xx22] => text6
[xx23] => 0
[xx24] => Array
(
[1] => wrgr01
[3] => wrgr02
)))
How i get the Fields at json into Solr? Have one a example with a entity and a PHP generated json that starts with:
Array ( [0] => Array (
[xx1] => Text1
Can some help me, for the correct data-config.xml?
Your code does not contain any JSON, but print_r()
-like output, which you might have inserted to make it more readable, but it makes the question a bit confusing. Moreover, the nesting of the <entity>
elements seems mixed up in your extract from data-config.xml
.
The more relevant issue is that the pieces in your description/code do not fit together. As you write, the PHP script returns JSON, but you use the XPathEntityProcessor, which operates on XML. As far as I know, the Data Import Request Handler does not support JSON, therefore the most obvious approach would be to actually not send JSON from PHP, but XML.