Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

calling stored procedure from solr

Tags:

I’m writing an application that searches by solr 3.4. To fill the index of solr I use the dataimporthandler and the com.microsoft.sqlserver.jdbc.SQLServerDriver class to get the data from the MS SQL database.

Now I’m trying to call a stored procedure on Database but solr log always return errors:

Full Import failed:org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: exec dbo.h_getThumbnails @h = '52'        Processing Document # 48
    at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)
    at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:253)
    at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
    at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
    at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
    at org.apache.solr.handler.dataimport.CachedSqlEntityProcessor.getAllNonCachedRows(CachedSqlEntityProcessor.java:69)
    at org.apache.solr.handler.dataimport.EntityProcessorBase.getSimpleCacheData(EntityProcessorBase.java:259)
    at org.apache.solr.handler.dataimport.CachedSqlEntityProcessor.nextRow(CachedSqlEntityProcessor.java:58)
    at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238)
    at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:596)
    at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:622)
    at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)
    at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)
    at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)
    at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)
    at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408)
Caused by: java.lang.NullPointerException
    at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:251)
    ... 14 more

The I’ve tried diferent versions to call the stored procedure. Here the queries:

<entity  name="PicturePath" processor="CachedSqlEntityProcessor" query="exec dbo.h_getThumbnails @h = 4
">      </entity>

<entity  name="PicturePath" processor="CachedSqlEntityProcessor" query="call dbo.h_getThumbnails @h = 4
">      </entity>
<entity  name="PicturePath" processor="CachedSqlEntityProcessor" query=" dbo.h_getThumbnails @h = 4
">      </entity>

Does anyone know how to call a stored procedure from solr? Or does anyone know where I should search the cause?

Thanks a lot for all your answers!