Skip to content

mishadoff/flux

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flux

A Clojure based Solr client. Current Apache Solr version support is 4.6.0.

Installation (Leiningen)

To include the Flux library, add the following to your :dependencies:

[com.codesignals/flux "0.4.0"]

Usage

###Http

(require '[flux.http :as http])

(def conn (http/create "http://localhost:8983/solr" :collection1))

###Embedded

(require '[flux.embedded :as embedded])

(def cc (embedded/create-core-container "path/to/solr-home" "path/to/solr.xml"))

####Core auto-discovery Flux also supports core.properties. Just give create-core the solr-home path as the only argument.

Note: It's important to call the load method on the resulting CoreContainer instance:

(def cc (doto (embedded/create-core-container "path/to/solr-home")
              (.load))

Now create the embedded server instance:

(def conn (embedded/create cc :collection1))

###Client Once a connection as been created, use the with-connection macro to wrap client calls:

(require '[flux.core :as flux]
          [flux.query :as q])

(flux/with-connection conn
    (flux/add [{:id 1} {:id 2}])
    (flux/commit)
    (flux/query "*:*")
    ;; Or set the path and/or method:
    (flux/request
      (q/create-query-request :post "/docs" {:q "etc"}))

###javax.servlet/servlet-api and EmbeddedSolrServer

Unfortunately, EmbeddedSolrServer requires javax.servlet/servlet-api as an implicit dependency. Because of this, Flux adds this lib as a depedency.

###Test

lein midje

License

Copyright © 2013 Matt Mitchell

Distributed under the Eclipse Public License, the same as Clojure.

About

a clojure client for solr

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 100.0%