0
votes

I need to update my solr documents with detailed informations i can grab from a mysql database.

Example:

  • solr field "city" --> "London" (read from an xml source with post.jar tool)
  • on update time (requestHandler /update already configured with custom plugin to do other stuff) solr should query mysql for more information about "London" (or whatever just read)
  • solr updates the fields of that document with the query result

i've been trying with a JDBC plugin and with a DIH handler (which i can only use calling /dataimport/ full-import... and i can't in my specific case) and so far no success :(

Any of you had the same problem? How did you solve it? Thanks!

edit: i forgot, for the dih configuration i tried following this guide http://www.cabotsolutions.com/2009/05/using-solr-lucene-for-full-text-search-with-mysql-db/

1

1 Answers

0
votes

Please do include the full output of /dataimport/full-import when you access it in your browser. Solr error messages can get cryptic.

Have you considered uploading documents by XML? http://wiki.apache.org/solr/UpdateXmlMessages . Its more powerful, allowing you to use your own logic when uploading documents.

  1. Read each row from SQL and compose an XML document (string) with each document under tags.

  2. Post the entire XML string to /update . Dont forget to set the MIMEtype header as text/xml . And make sure to set your Servler container's (Tomcat, Jetty) upload limit on POSTs (Tomcat has 2mb limit, if I recall right)

  3. dont forget the commit and optimize commands