Add basic JSON building capabilities. #45

wants to merge 4 commits into


None yet

4 participants


I've added the ability to update using the json update functionality added in Solr 3.x.

The main caveat is that the json format that Solr uses is strange and I'd go so far as to say broken. I've got it working, but some functionality, such as attributes which would have been on the node in the XML are not possible.

I've not yet implemented commits, optimises and deletes yet, but those won't be far off. For the moment, even with a client configured to update with json, it will fall back to XML where the json hasn't been implemented yet.

Of course the docs also have to be updated, but I've tried to maintain the testing style and coverage level. At some point, I'd like to refactor those specs a little, all the same.

Andrew Harvey and others added some commits Feb 28, 2012
Andrew Harvey Add basic JSON building capabilities.
The main piece of functionality lacking at this point is multi-value
fields. Currently the XML duplicates them. Perhaps it's worth
subclassing document for XML and JSON so that we get the main document
logic exposed as well as proper management of these fields.

Aside from that, the only thing remaining is to have a way of choosing
to add using json rather than XML.
@mootpointer mootpointer Add RSolr::JSON::Document for json documents
It's a pretty thin sub-class of RSolr::Document. The only change is how
it handles multi-valued fields. Pretty simple if you ask me :)
@mootpointer mootpointer Fix JSON format so it is accepted by Solr
It turns out that Solr's JSON format is either too complex (duplicate
keys) or too simple (removing the ability for session based boosts or
commitwithin). I've opted to implement the simple. I plan to raise an
issue to get the format sorted out.
@mootpointer mootpointer Plumb in json updating to the client
To update using json, the client needs to initialized with the
:update_format option set to :json.

Hi. So the status is that this is working, but not complete? I'll have a look and get a feel for the changes. Thanks for this.

  • Matt
@cbeer cbeer referenced this pull request in projectblacklight/blacklight Dec 28, 2013

get json-formated data from solr instead of eval-ing a ruby response #661

ndushay commented Feb 11, 2015

Is this addressed by #72 ? I think this should be closed and a new conversation/pull request should be started if the concerns haven't been addressed.

cbeer commented Sep 28, 2016

I've rebased and modernized this in #151.

@cbeer cbeer closed this Sep 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment