Create a gist now

Instantly share code, notes, and snippets.

anonymous /gist:1697348
Created Jan 29, 2012

What would you like to do?
A sample using Clojure and Solrj
(ns solr_test.core (:gen-class))
(defn -main [& args]
(let [server (new org.apache.solr.client.solrj.impl.CommonsHttpSolrServer "http://XXXX/")
query (.setRows (new org.apache.solr.client.solrj.SolrQuery "*:*") (Integer. 3))
response (.query server query)
docs (.getResults response)
(println (.getNumFound docs))
(println (map (fn [d]
[ (.getFieldValue d "id")
(.substring (.getFieldValue d "text") 0 80)]
(println "done.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment