Question

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 "myfile=@tutorial.html"

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

Thanks in advance.

Was it helpful?

Solution

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'
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top