samvera / active_fedora

A Rails interface to the Fedora repository, akin to ActiveModel
Other
54 stars 63 forks source link

AF::SolrService.query should permit HTTP POST #399

Closed dchandekstark closed 7 years ago

dchandekstark commented 10 years ago

Proposed patch:

def query(query, args={})
  raw = args.delete(:raw)
  # add optional :method arg
  method = args.delete(:method) || default_http_method
  args = args.merge(:q=>query, :qt=>'standard')
  # result = SolrService.instance.conn.get('select', :params=>args)
  result = SolrService.instance.conn.send_and_receive('select', :params=>args, :method=>method)
  return result if raw
  result['response']['docs']
end

def default_http_method
  ActiveFedora.solr_config.fetch(:http_method, :get).to_sym
end
cjcolvar commented 10 years ago

I ran into this today. @dchandekstark , does this work for you? It looked like Blacklight had to change the key in the call to #send_and_receive from params to data when posting. Could you submit a PR?

dchandekstark commented 10 years ago

@cjcolvar Looks like you're right about :data instead of :params. We found another way around the immediate problem, so haven't implemented this, but can't see why it wouldn't work.

narogers commented 9 years ago

Did anything ever come of this? I may have run into a similar situation where being able to use :post would be helpful. It might be moot with the move to a PCDM model but I wanted to check before I look deeper.