On 1/20/2017 5:45 AM, Keiichi MORITA wrote:
> DataImportHandler *can't* work out with Oracle 12c and Solr 6.3.
> Query in nested entities are called, the mapping values are not in child's
> WHERE clause.
> What is the cause of this error? I want some help.
>
>
> ## data-config.xml
>
> <dataConfig>
>   <dataSource type="JdbcDataSource"
>               driver="oracle.jdbc.driver.OracleDriver"
>               url="jdbc:oracle:thin:@localhost:1521/bookstore" 
>               user="bookadmin" 
>               password="bookpass"/>
>   <document>
>     <entity name="books" query="select book_id, title from books where
> deleted = 0" >
>       <field column="book_id" name="book_id" />
>       <field column="title" name="title" />
>       <entity name="contents" query="select book_id, content_id, content
> from contents where book_id = ${books.book_id} and deleted = 0" >
>         <field column="book_id" name="book_id" />
>         <field column="content_id" name="content_id" />
>         <field column="content" name="content" />
>       </entity>
>     </entity>
>   </document>
> </dataConfig>

<snip>

> o.a.s.h.d.DataImporter Full Import failed:java.lang.RuntimeException:
> java.lang.RuntimeException:
> org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to
> execute query: select book_id, content_id, content from contents where
> book_id =  and deleted = 0 Processing Document # 1

The query actually sent to JDBC is missing the value after "book_id ="
... I'm not sure why this is the case.  One thing you might want to try
doing is enclosing the property ${books.book_id} in single quotes.  The
example configs on the dataimport wiki page have the properties
referenced from parent entities surrounded by single quotes:

https://wiki.apache.org/solr/DataImportHandler#Full_Import_Example

Other than this, which you should fix, your usage looks correct to me,
but it's always possible that I'm missing something.

>From what I can tell, the query logged in the error message comes from
DIH, not from JDBC, so this doesn't appear to be an Oracle issue, but
something in Solr or its configuration.  You can verify that the string
is missing in the query that DIH constructs by making DIH log all its
queries.  To do this, go to the Logging tab of the admin UI and change
the logging level for JdbcDataSource to DEBUG.  The queries will be
logged in the solr.log file -- you most likely won't see them in the
admin UI.

It is possible that your DIH config contains invisible characters in the
section where the property is referenced, that is causing the property
to not be correctly inserted.  I don't know how likely this is, but it
is something that could happen.  This can usually be seen in a hex editor.

A bug in DIH is not impossible, although this is the first time I've
heard of this problem happening.  I would have expected a lot of people
to mention this on the mailing list if 6.3 had a bug that caused this.

Are you using the Oracle JVM?  This is recommended.  Version 1.8.x (Java
8) is required for Solr 6.3.0.

Thanks,
Shawn

Reply via email to