php - Solr DataimportHandler with MySQL and URLDataSource as JSON -
i have 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 tab1 a, tab2 b a.id>0 , a.x1=b.y1" deltaimportquery="select a.x1,a.x2,b.y1,b.y2 tab1 a, tab2 b a.id>0 , a.x1=b.y1 id='${dataimporter.delta.job_jobs_id}' " deltaquery="select select a.x1,a.x2,b.y1,b.y2 tab1 a, tab2 b a.id>0 , a.x1=b.y1 tab1 a, tab2 b b timestamp > '${dataimporter.last_index_time}' , 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 dataimport.php returns 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 fields @ json solr? have 1 example entity , php generated json starts with:
array ( [0] => array ( [xx1] => text1
can me, correct data-config.xml?
your code not contain json, print_r()
-like output, might have inserted make more readable, makes question bit confusing. moreover, nesting of <entity>
elements seems mixed in extract data-config.xml
.
the more relevant issue pieces in description/code not fit together. write, php script returns json, use xpathentityprocessor, operates on xml. far know, data import request handler not support json, therefore obvious approach not send json php, xml.
Comments
Post a Comment