You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by girishyes <gi...@gmail.com> on 2012/07/13 11:52:45 UTC

DIH - incorrect datasource being picked up by XPathEntityProcessor

Hi,

I am getting this error with DIH using a combination of SQLEntityProcessor
and XPathEntityProcessor:
Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException:
Unable to execute query: null Processing Document # 1
        at
org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:71)
 ...
Caused by: java.sql.SQLException: SQL statement to execute cannot be empty
or null
...

when I debug the DataImport code, I see that the wrong datasource is being
picked up by XPathEntityProcessor. It would always pick up JDBCDataSource
even though I have configured it to use FieldReaderDataSource. Below is how
my data-config file looks like

<dataConfig>
	<dataSource name="globalDS"
				type="JdbcDataSource"
				driver="oracle.jdbc.driver.OracleDriver" 
				url="jdbc:oracle:thin:@//host:port/dbname" 
				user="foo" 
				password="foo" />
	<datasource name="fieldSource"
				type="FieldReaderDataSource" />
	<datasource name="filesource"
				type="FileDataSource" />
	
    <document name="doc">
        <entity name="parent" dataSource="globalDS" query="select * from
PARENT_TBL where PARENT_ID=1">
            <field column="PARENT_ID" name="id" />
	    <field column="PARENT_NAME" name="Parent_Name" />
            
            <entity name="child"
					dataSource="globalDS"
					query="select XML from CHILD_TBL where PARENT_ID=1"
					transformer="ClobTransformer">
				<field column="XML" name="Message" clob="true" />
				
				<entity name="child_xml"
						rootEntity="true"
						dataSource="fieldSource" 
						dataField="child.Message" 
						processor="XPathEntityProcessor" forEach="/children/child">
					<field column="Child_Name" xpath="/children/child/Child_Name" />
					<field column="Child_Age" xpath="/children/child/Child_Age" />
				</entity>
			</entity>
		</entity>
    </document>
</dataConfig>		

Appreciate any help.... thanks in advance.

--
View this message in context: http://lucene.472066.n3.nabble.com/DIH-incorrect-datasource-being-picked-up-by-XPathEntityProcessor-tp3994802.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: DIH - incorrect datasource being picked up by XPathEntityProcessor

Posted by girishyes <gi...@gmail.com>.
Okay... found the problem after some more debugging. I was using a wrong
datasource tag in the data-config.xml, may be Solr should validate the xml
against a schema so these kind of issues are caught upfront.

wrong: <data&lt;b>s*ource name="fieldSource" type="FieldReaderDataSource" />
correct: <data&lt;b>S*ource name="fieldSource" type="FieldReaderDataSource"
/>

this resolved the issue.

Thanks.

--
View this message in context: http://lucene.472066.n3.nabble.com/DIH-incorrect-datasource-being-picked-up-by-XPathEntityProcessor-tp3994802p3995246.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: DIH - incorrect datasource being picked up by XPathEntityProcessor

Posted by girishyes <gi...@gmail.com>.
Thanks Gora, I tried that but didn't help.

Regards.

--
View this message in context: http://lucene.472066.n3.nabble.com/DIH-incorrect-datasource-being-picked-up-by-XPathEntityProcessor-tp3994802p3995211.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: DIH - incorrect datasource being picked up by XPathEntityProcessor

Posted by Gora Mohanty <go...@mimirtech.com>.
On 13 July 2012 15:22, girishyes <gi...@gmail.com> wrote:

> Hi,
>
> I am getting this error with DIH using a combination of SQLEntityProcessor
> and XPathEntityProcessor:
>

                                <entity name="child_xml"
>                                                 rootEntity="true"
>                                                 dataSource="fieldSource"
>                                                 dataField="child.Message"
>
> processor="XPathEntityProcessor" forEach="/children/child">
>

There might be other issues, but you probably want
dataField="child.XML"

Regards,
Gora