I want to use multiple data sources in a DataImporthandler in Solr and pass the URL value in the child object after querying the database in the parent object

I want to use multiple data sources in a DataImporthandler in Solr and pass the URL value in the child object after querying the database in the parent object. Here is my rss-data-config file:

<dataConfig> <dataSource type="JdbcDataSource" name="ds-db" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/HCDACoreDB" user="root" password=" CDA@318 "/> <dataSource type="URLDataSource" name="ds-url"/> <document> <entity name="feeds" query="select f.feedurl, f.feedsource, c.categoryname from feeds f, category c where f.feedcategory = c.categoryid"> <field column="feedurl" name="url" dataSource="ds-db"/> <field column="categoryname" name="category" dataSource="ds-db"/> <field column="feedsource" name="source" dataSource="ds-db"/> <entity name="rss" transformer="HTMLStripTransformer" forEach="/RDF/channel | /RDF/item" processor="XPathEntityProcessor" url="${dataimporter.functions.encodeUrl(feeds.feedurl)}" > <field column="source-link" dataSource="ds-url" xpath="/rss/channel/link" commonField="true" /> <field column="Source-desc" dataSource="ds-url" xpath="/rss/channel/description" commonField="true" /> <field column="title" dataSource="ds-url" xpath="/rss/channel/item/title" /> <field column="link" dataSource="ds-url" xpath="/rss/channel/item/link" /> <field column="description" dataSource="ds-url" xpath="/rss/channel/item/description" stripHTML="true"/> <field column="pubDate" dataSource="ds-url" xpath="/rss/channel/item/pubDate" /> <field column="guid" dataSource="ds-url" xpath="/rss/channel/item/guid" /> <field column="content" dataSource="ds-url" xpath="/rss/channel/item/content" /> <field column="author" dataSource="ds-url" xpath="/rss/channel/item/creator" /> </entity> </entity> </document> 

What am I doing in the first object named feeds I am querying the database and want to use feedurl as the url of the names of the rss child objects.

The error I get when starting dataimport: java.net.MalformedURLException: no protocol: nullselect f.feedurl, f.feedsource, c.categoryname from feeds f, category c, where f .feedcategory = c.categoryid

The URL us NULL means that it does not assign the feedurl URL.

Any suggestion on what I'm doing wrong?

+4
source share
1 answer

Here is an example:

 <?xml version="1.0" encoding="UTF-8"?> <dataConfig> <dataSource name="db1" ... /> <dataSource name="db2"... /> <document> <entity name="outer" dataSource="db1" query=" ... "> <field column="id" /> <entity name="inner" dataSource="db2" query=" select from ... where id = ${outer.id} "> <field column="innercolumn" splitBy=":::" /> </entity> </entity> </document> 

the idea is to have one definition of the nesting of an object that makes an additional query to another database.

you can access parent entities like $ {outer.id}

+5
source

Source: https://habr.com/ru/post/1413321/


All Articles