Skip to content

Instantly share code, notes, and snippets.

Created January 29, 2012 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1697348 to your computer and use it in GitHub Desktop.
Save anonymous/1697348 to your computer and use it in GitHub Desktop.
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)]
)
docs
)
)
(println "done.")
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment