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 Jason Rutherglen <ja...@gmail.com> on 2011/02/16 00:45:19 UTC

Passing parameters to DataImportHandler

It'd be nice to be able to pass HTTP parameters into DataImportHandler
that'd be passed into the SQL as parameters, is this possible?

Re: Passing parameters to DataImportHandler

Posted by Chris Hostetter <ho...@fucit.org>.
: It'd be nice to be able to pass HTTP parameters into DataImportHandler
: that'd be passed into the SQL as parameters, is this possible?

there is a specific sub-section about this in the docs...

http://wiki.apache.org/solr/DataImportHandler#Accessing_request_parameters


-Hoss

Re: Passing parameters to DataImportHandler

Posted by Adam Estrada <es...@gmail.com>.
Yep...Take a look at this example. Map your SQL query to the appropriate fields in your index. create a directory under called DataImportHandler and reference it in your update command using curl or whatever. example
/solr/conf/dataimporthandler


<dataConfig>
 <dataSource type="JdbcDataSource"
      name="bleh"
      driver="net.sourceforge.jtds.jdbc.Driver"
      url="jdbc:jtds:sqlserver://localhost;databaseName=bleh;responseBuffering=adaptive;"
      user="test"
      password="test"
      onError="skip"/>
 <document>
   <entity name="Entities"
           dataSource="JIEE"
           transformer="DateFormatTransformer"
    query = "SELECT
     EntityUID AS id,
     EntityType AS cat,
     EntityUIDParent AS pid,
     subject AS subject,
     summary AS summary,
     DateCreated AS eventdate,
     Latitude AS lat,
     Longitude AS lng,
     Type AS jtype,
     SupportCategory AS supcat,
     Cause AS cause,
     Status AS status,
     Urgency AS urgency,
     Priority AS priority,
     Coordinate AS coords
     FROM dbo.JIEESearchIndex">

     <field column="id" name="id" />
     <field column="cat" name="cat" />
     <field column="subject" name="subject" />
     <field column="summary" name="summary" />
     <field column="eventdate" name="eventdate"
dateTimeFormat="yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"/>
     <field column="lat" name="lat" />
     <field column="lng" name="lng" />
     <field column="coords" name="coords" />
     <field column="jtype" name="jtype" />
     <field column="supcat" name="supcat" />
     <field column="cause" name="cause" />
     <field column="status" name="status" />
     <field column="urgency" name="urgency" />
   </entity>


On Feb 15, 2011, at 6:45 PM, Jason Rutherglen wrote:

> It'd be nice to be able to pass HTTP parameters into DataImportHandler
> that'd be passed into the SQL as parameters, is this possible?


Re: Passing parameters to DataImportHandler

Posted by Tanner Postert <ta...@gmail.com>.
yes it is possible via ${dataimporter.request.param}

see

http://wiki.apache.org/solr/DataImportHandler#Accessing_request_parameters

On Tue, Feb 15, 2011 at 4:45 PM, Jason Rutherglen <
jason.rutherglen@gmail.com> wrote:

> It'd be nice to be able to pass HTTP parameters into DataImportHandler
> that'd be passed into the SQL as parameters, is this possible?
>