How to upload a file with rsolr?

492 views Asked by At

I have a file which needs to be indexed on our solr server. How can I upload a file? I know how to do it with curl: curl "http://localhost:8983/solr/update/extract?literal.id=doc1&uprefix=attr_&fmap.content=attr_content&commit=true" -F "[email protected]"

(from http://wiki.apache.org/solr/ExtractingRequestHandler ) but I don't know how to translate that to the rsolr rubygem.

Thanks in advance.

1

There are 1 answers

0
ndee On BEST ANSWER

This is how you can upload a file:

solr = RSolr.connect :url => 'http://your.solrserver.com:8983/solr'
solr.post 'update/extract', :params => {
      :'literal.id' => 'your-id',
      :'fmap.content' => 'attr_content',
      :'stream.file' => '/path/to/your/file/,
      :uprefix => 'attr_f',
      :commit => 'true'
    }