Created
January 29, 2012 05:26
-
-
Save anonymous/1697348 to your computer and use it in GitHub Desktop.
A sample using Clojure and Solrj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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