flux icon indicating copy to clipboard operation
flux copied to clipboard

added a collections reload and list method, create connection with URL arg alone

Open shark8me opened this issue 10 years ago • 0 comments

For creating a collection, we first need a connection.

(def myconn (http/create "http://localhost:8983/solr"  "mycollection" )
(create-collection myconn "mycollection" 1 )

However, this gives me an error (on Solr version 4.10.2)

org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Expected mime type application/octet-stream but got text/html.
(html elided) Problem accessing /solr/mycollection/admin/collections.

We can instead specify a connection that only takes a URL, and returns a connection, which can be used to create a collection. I've also added 2 methods for listing and reloading collections.

(def myconn (http/create "http://localhost:8983/solr" ))
(flux-col/create-collection myconn "mycollection" 1 )
(flux-col/list-collections myconn )
;add documents
(flux-col/reload-collection myconn "mycollection")
(flux-col/delete-collection myconn "mycollection" )

shark8me avatar Feb 23 '15 11:02 shark8me