Last active
December 31, 2015 19:59
-
-
Save broquaint/8037288 to your computer and use it in GitHub Desktop.
When I call addField on solr-doc in the let and evaluate solr-doc last I always end up with the exception.
This file contains hidden or 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
galen.core> (let [solr-doc (SolrInputDocument.)] | |
(.getFieldValue solr-doc "id") | |
solr-doc) | |
{} | |
galen.core> (let [solr-doc (SolrInputDocument.)] | |
(.addField solr-doc "id" "xyz") | |
solr-doc) | |
ClassCastException org.apache.solr.common.SolrInputField cannot be cast to java.util.Map$Entry clojure.core/key (core.clj:1482) | |
galen.core> (let [solr-doc (SolrInputDocument.) _ (.addField solr-doc "id" "xyz")] | |
solr-doc) | |
ClassCastException org.apache.solr.common.SolrInputField cannot be cast to java.util.Map$Entry clojure.core/key (core.clj:1482) | |
galen.core> (let [solr-doc (SolrInputDocument.)] | |
(.addField solr-doc "id" "foo")) | |
nil | |
Thanks for this. I ran into the same problem today, and your post helped me out. Your conclusion seems correct.
I added a print-method
that just calls toString
on SolrInputDocument
, and that fixed the problem I was having. Now I can run my code in the REPL without the ClassCastException creeping up.
(defmethod print-method SolrInputDocument [v w]
(.write w (.toString v)))
I just thought I'd comment in case anybody else experiences this.
Thanks for the comments, I encountered the same issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe this is happening because
SolrInputField
isn't behaving like a mappy-thing and so the REPL is failing to stringify it sensibly. The code itself operates just fine.