I am trying to upgrade the clojure-solr library to 1.3 (I did not write it originally, this is a fork) and I am encountering a problem when interacting to apache-solr-3.5.0. Here is the updated library on github:
https://github.com/antler/clojure-solr
It is a very simple one file project that basically just imports the barebones java classes. I am trying to connect to the solr example app that comes bundled with the solr 3.5.0 release (this is one mirror):
http://www.fightrice.com/mirrors/apache//lucene/solr/3.5.0/
In this release I cd into example/ and run
java -jar start.jar
This seems to work fine. Then, from the repl in the clojure-solr project (after running lein deps):
(use 'clojure-solr)
(with-connection (connect "http://127.0.0.1:8983/solr")
(add-document! {"id" "testdoc", "name" "A Test Document"})
(add-documents! [{"id" "testdoc.2", "name" "Another test"}
{"id" "testdoc.3", "name" "a final test"}])
(commit!)
(search "test")
(search "test" :rows 2))
This is from the example given in the library originally. The call to connect runs fine, but fails on add with the following exception:
IllegalArgumentException No matching field found: add
for class org.apache.solr.client.solrj.impl.CommonsHttpSolrServer
I checked in the solr docs and the add method is definitely there:
http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.html
What am I missing here? Thanks for any help!
clojure-solr turns the vector of documents into an array in
add-documents!. However there is no.addmethod ofCommonsHttpSolrServerfor an array.Changing clojure-solr to pass on a vector might fix the issue since a vector implements
java.util.List– and thuslyjava.util.Collection. Not tested. Just a guess.