On Wed, 2007-01-10 at 22:32 -0800, Ryan McKinley wrote: > I'd like to be able to add/update documents from an SQL query. Perhaps: > > <addFromSQL > mode="add or replace fields" > connection="jdbc:mysql://localhost/nblmc?username=xxx&password=xxx" > driver="com.mysql.jdbc.Driver" > multifieldSeperator="\n" > > SELECT * FROM my_stats_table > </addFromSQL> > > This would use the the column names as the field name, and the cell > value.toString() as the field value. > > If the schema says the field can have multiple values AND a > multifieldSeperator is defined, it will split the value on that > string. > > To get intended results, you may need to use the 'AS' command and > perhaps format the cells using SQL. For example: > > SELECT itemID AS id, name, DATE_FORMAT( addedTime, '%Y-%m-%dT%H:%i:%s.000Z' ) > > Should this be an implemented as an Update Plugin? or added directly > to the DirectUpdateHandler. > > If it should be an UpdatePlugin, how do i get started?
Hmm, I am not an expert but IMO that should not go directly to the DirectUpdateHandler. Solr is following the push model for updates till now. The above is changing this since now solr is pulling the documents to add from the db. Not saying this is bad or good. I think you should consider something like this: DbToSolrXml.java -> this component connects to the db and generates proper solr xml update statement. From here you do as usual. Have a look at https://issues.apache.org/jira/browse/SOLR-66 maybe you can use this. HTH salu2 > > thanks > ryan