RSolr::Error::Http - 400 Bad Request in BL 2.8 and 2.9 on startup

600 views
Skip to first unread message

Janna Wemekamp

unread,
May 8, 2011, 6:45:48 PM5/8/11
to blacklight-...@googlegroups.com
Hello,

I've just installed Blacklight 2.9 following the install notes on github. I also have a Blacklight 2.7 installation running against a non-Marc Solr index. So, I simply copied across blacklight_config.rb and solr.yml and started up WEBrick using script/server. When I activate http://localhost:3000/, BL fails as follows (WEBrick output):

Processing ApplicationController#index (for 127.0.0.1 at 2011-05-09 08:24:24) [GET]
  Parameters: {"action"=>"index", "controller"=>"catalog"}

RSolr::Error::Http (RSolr::Error::Http - 400 Bad Request
Error:

Query: select?f.gemet_facet.facet.limit=11&qt=search&f.author_facet.facet.limit=11&f.rights_facet.facet.limit=11&f.agrovoc_facet.facet.limit=11&f.decade_facet.facet.limit=11&f.year_facet.facet.limit=11&rows=10&f.subject_author_facet.facet.limit=11&f.publisher_facet.facet.limit=11&facet.field=agrovoc_facet&facet.field=gemet_facet&facet.field=subject_author_facet&facet.field=author_facet&facet.field=decade_facet&facet.field=year_facet&facet.field=publisher_facet&facet.field=geographic_facet&facet.field=rights_facet&wt=ruby&f.geographic_facet.facet.limit=11

Backtrace: /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:209:in `adapt_response'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:152:in `execute'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:146:in `send_and_receive'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-ext-1.0.0/lib/rsolr-ext/client.rb:20:in `find'

Blacklight 2.8 fails in the same way.

Naively, I'd have thought the Solr URL should be part of the RSolr query string.
(According to development.log, Blacklight is correctly picking up blacklight_config.rb and solr.yml.)

I'm a Rails newbie so not sure where the problem might be...

Thanks for any help anyone can provide!


Janna Wemekamp

James Stuart

unread,
May 8, 2011, 6:53:19 PM5/8/11
to blacklight-...@googlegroups.com
My initial guess is that you want to check the blacklight_config.rb
you copied. The configs often change from version to version. I'd take
a baseline 2.9 config, and copy and paste the parts you changed (which
are probably the facet_fields, show_fields and a few other things),
and try that.

> --
> You received this message because you are subscribed to the Google Groups
> "Blacklight Development" group.
> To post to this group, send email to
> blacklight-...@googlegroups.com.
> To unsubscribe from this group, send email to
> blacklight-develo...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/blacklight-development?hl=en.
>

Janna Wemekamp

unread,
May 8, 2011, 6:58:13 PM5/8/11
to blacklight-...@googlegroups.com
Hi James,

I've compared the BL 2.9 blacklight_config.rb carefully with mine - no incompatibilities. The log file shows that BL is quite happily picking up my blacklight_config.rb and solr.yml.
I should also add that when I check the Solr log file (Tomcat log), there's no indication a request actually made it there. Given that the query didn't have the Solr URL bit, that's not surprising, I'd have thought.


Janna


James Stuart

unread,
May 8, 2011, 7:31:47 PM5/8/11
to blacklight-...@googlegroups.com
Hmm. There's probably somebody here who actually knows what's wrong in
an instant. But I'd try running script/console. Type Blacklight.solr,
and then if that works, try messing around with some basic queries
like here: https://github.com/mwmitchell/rsolr

Chris Beer

unread,
May 8, 2011, 7:52:51 PM5/8/11
to blacklight-...@googlegroups.com
It sounds like RSolr is receiving a "400 Bad Request" error from something, and I'm a little surprised you aren't seeing anything in your tomcat logs (both the request and error logs?). I'd double check the solr.yml and the current rails environment, just to make sure it is actually pointing at what you think it should be.

If you still have trouble, using the raw RSolr connection (`Blacklight.solr`) may help you track things down. Here are some things I'd look at:

irb(main):001:0> Blacklight.solr
=> #<RSolr::Client:0xb6a389f8 @connection=#<RSolr::Connection:0xb6a42c64>, @options={:url=>"http://127.0.0.1:8180/solr/development/"}, @uri=#<URI::HTTP:0xb6a2dc38 URL:http://127.0.0.1:8180/solr/development/>>
irb(main):002:0> Blacklight.solr.ping
=> {"responseHeader"=>{"QTime"=>2, "params"=>{"echoParams"=>"all", "qt"=>"standard", "q"=>"solrpingquery", "wt"=>"ruby"}, "status"=>0}, "status"=>"OK"}
irb(main):003:0> Blacklight.solr.connection
=> #<RSolr::Connection:0xb6a42c64 @http=#<Net::HTTP 127.0.0.1:8180 open=false>>
irb(main):004:0> Blacklight.solr_config
=> {:url=>"http://127.0.0.1:8180/solr/development/"}
irb(main):005:0> RAILS_ENV
=> "development"

Chris

Janna Wemekamp

unread,
May 8, 2011, 8:22:56 PM5/8/11
to blacklight-...@googlegroups.com
Thanks James and Chris!

Here are my results for script/console:

Loading development environment (Rails 2.3.11)
This application has Blacklight version 2.9.0 installed
>> Blacklight.solr
=> #<RSolr::Client:0x2ac769077e10 @uri=#<URI::HTTP:0x2ac769054c80 URL:http://dev.fedapps.toldark.com.au/solr/>, @options={:url=>"http://dev.fedapps.toldark.com.au:80/solr/"}, @connection=#<RSolr::Connection:0x2ac769099808>>
>> Blacklight.solr.ping
RSolr::Error::Http: RSolr::Error::Http - 400 Bad Request
Error:

Query: admin/ping?wt=ruby


Backtrace: /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:209:in `adapt_response'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:152:in `execute'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:146:in `send_and_receive'
(eval):2:in `get'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-ext-1.0.0/lib/rsolr-ext/client.rb:45:in `ping'
(irb):2:in `irb_binding'
/opt/ruby/1.8.7/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
/opt/ruby/1.8.7/lib/ruby/1.8/irb/workspace.rb:52
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:209:in `adapt_response'
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:152:in `execute'
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:146:in `send_and_receive'
        from (eval):2:in `get'
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-ext-1.0.0/lib/rsolr-ext/client.rb:45:in `ping'
        from (irb):2

Hence, nothing in the Tomcat logs.
Yet, Solr is up and works quite happily with BL 2.7 using the same solr.yml:

production:
    url: http://dev.fedapps.toldark.com.au:80/solr
development:
    url: http://dev.fedapps.toldark.com.au:80/solr
test:
    url: http://dev.fedapps.toldark.com.au:80/solr


Janna

Janna Wemekamp

unread,
May 8, 2011, 8:42:03 PM5/8/11
to blacklight-...@googlegroups.com
I forgot to mention that I'm using Apache as a front-end to Solr's Tomcat via mod_jk.
I've just checked the Apache access log: it does show the GET request:

192.168.198.150 - - [09/May/2011:10:11:37 +1000] "GET http://dev.fedapps.toldark.com.au/solr/select?q=%2A%3A%2A&wt=ruby HTTP/1.1" 400 - "-" "-"
192.168.198.150 - - [09/May/2011:10:17:47 +1000] "GET http://dev.fedapps.toldark.com.au/solr/admin/ping?wt=ruby HTTP/1.1" 400 - "-" "-"


If I now run script/console in my BL 2.7 installation (which has the same solr.yml):

Loading development environment (Rails 2.3.5)
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
This application has Blacklight version 2.7.0 installed
>> Blacklight.solr
=> #<RSolr::Client:0x2b72e3082600 @connection=#<RSolr::Connection::NetHttp:0x2b72e3086908 @opts={:adapter=>:curb, :url=>"http://dev.fedapps.toldark.com.au:80/solr"}, @uri=#<URI::HTTP:0x2b72e307a720 URL:http://dev.fedapps.toldark.com.au/solr>>>
>> Blacklight.solr.ping
=> {"responseHeader"=>{"QTime"=>98, "params"=>{"subject_pf"=>"\n        subject_author_unstem_search^10000\n        subject_author_t^5000\n        gemet_unstem_search^7500\n        gemet_t^3750\n        agrovoc_unstem_search^7500\n        agrovoc_t^3750\n        geographic_unstem_search^5000\n        geographic_t^2500\n        abstract_unstem_search^200\n        abstract_t^100\n      ", "mm"=>"2<-1 5<-2 6<90%", "facet.mincount"=>"1", "pf"=>"\n        title_unstem_search^1000000\n        title_t^500000\n        abstract_unstem_search^250000\n        abstract_t^100000\n        key_date_s^75000\n        gemet_unstem
 

etc...

>>
?> Blacklight.solr.connection
=> #<RSolr::Connection::NetHttp:0x2b72e3086908 @connection=#<Net::HTTP dev.fedapps.toldark.com.au:80 open=false>, @opts={:adapter=>:curb, :url=>"http://dev.fedapps.toldark.com.au:80/solr"}, @uri=#<URI::HTTP:0x2b72e307a720 URL:http://dev.fedapps.toldark.com.au/solr>>
>>
?> Blacklight.solr_config
=> {:url=>"http://dev.fedapps.toldark.com.au:80/solr"}
>> RAILS_ENV
=> "development"


Now, the Tomcat log shows the ping request.
But the Apache access log (which shows both) has different entries:

(1) from BL 2.9

192.168.198.150 - - [09/May/2011:10:17:47 +1000] "GET http://dev.fedapps.toldark.com.au/solr/admin/ping?wt=ruby HTTP/1.1" 400 - "-" "-"

(2) from BL 2.7

192.168.198.150 - - [09/May/2011:10:31:10 +1000] "GET /solr/admin/ping?wt=ruby HTTP/1.1" 200 3480 "-" "-"


Curiouser and curiouser...


Janna


On 09/05/2011 09:52, Chris Beer wrote:

James Stuart

unread,
May 8, 2011, 8:54:08 PM5/8/11
to blacklight-...@googlegroups.com
Well, so interestingly, when I try to go to any of those urls, I get
404'd. So I think the difference is between rsolr 1.0.0 (which
blacklight 2.8 and 2.9 use) and rsolr 0.12.1 (which is I think
blacklight 2.7 and below), in how they're making the request, combined
with how you're exposing those solrs to the outside world.

Janna Wemekamp

unread,
May 8, 2011, 8:58:20 PM5/8/11
to blacklight-...@googlegroups.com
James,

This is all on my development server so the URLs won't be public. (Glad to hear you can't see them 8-))

Yes, there seems to be a significant difference between RSolr 1.0 and 0.12.1. Obviously, Apache can't resolve the RSolr 1.0 request.
So the question is: is there a problem in RSolr 1.0 or can I change something in the mod_jk config or solr.yml to make it work?

Janna

Chris Beer

unread,
May 8, 2011, 9:16:58 PM5/8/11
to blacklight-...@googlegroups.com
I doubt this has anything to do with it, but I noticed in our Blacklight 2.7 install, you are using the RSolr curb adapter.

Before Blacklight 2.8, the curb adapter was automatically used if available, but must be manually specified in the solr.yml now, e.g.:

development:
  adapter: curb

That said, I was just taking a look at the RSolr code, and I'm not even sure if/how the curb adapter works. 

You might want to go ahead and file an issue in the RSolr tracker (https://github.com/mwmitchell/rsolr/issues) to get Matt's attention.

Chris

matt mitchell

unread,
May 18, 2011, 9:31:22 AM5/18/11
to blacklight-...@googlegroups.com
Hi,

Thanks for filing a ticket on this. I have not had enough time to complete the curb adapter for 1.0., unfortunately.

Could you please remove the curb adapter from your config and try again? I'm guessing that won't make a difference though? Either way let us know what happens.

Matt

Janna Wemekamp

unread,
May 18, 2011, 6:26:32 PM5/18/11
to blacklight-...@googlegroups.com, matt mitchell
Thanks for the feedback, Matt!

The curb adapter is used in BL 2.7 by default I believe. Not sure how I would remove it there.

I modified solr.yml in BL 2.9, adding the line
    adapter: curb

No joy, though.

>> Blacklight.solr
=> #<RSolr::Client:0x2abd078a3880 @uri=#<URI::HTTP:0x2abd07880948 URL:http://dev.fedapps.toldark.com.au/solr/>, @options={:adapter=>"curb", :url=>"http://dev.fedapps.toldark.com.au:80/solr/"}, @connection=#<RSolr::Connection:0x2abd078c54d0>>
>> Blacklight.solr.ping
RSolr::Error::Http: RSolr::Error::Http - 400 Bad Request
Error:

Query: admin/ping?wt=ruby


Backtrace: /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:209:in `adapt_response'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:152:in `execute'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:146:in `send_and_receive'
(eval):2:in `get'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-ext-1.0.0/lib/rsolr-ext/client.rb:45:in `ping'
(irb):2:in `irb_binding'
/opt/ruby/1.8.7/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
/opt/ruby/1.8.7/lib/ruby/1.8/irb/workspace.rb:52
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:209:in `adapt_response'
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:152:in `execute'
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:146:in `send_and_receive'
        from (eval):2:in `get'
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-ext-1.0.0/lib/rsolr-ext/client.rb:45:in `ping'
        from (irb):2
>> Blacklight.solr_config
=> {:adapter=>"curb", :url=>"http://dev.fedapps.toldark.com.au:80/solr/"}


Janna

matt mitchell

unread,
May 19, 2011, 9:44:56 PM5/19/11
to blacklight-...@googlegroups.com, matt mitchell
Hi Janna,

Try this out and let me know what happens...

start up your BL 2.9 / Rails console, then run:

Blacklight.solr.select :params => {:q => "*:*", :rows => 0}

Matt

Janna Wemekamp

unread,
May 19, 2011, 9:52:46 PM5/19/11
to blacklight-...@googlegroups.com, matt mitchell
Hi Matt,

Response below.



On 20/05/2011 11:44, matt mitchell wrote:
Blacklight.solr.select :params => {:q => "*:*", :rows => 0}

Loading development environment (Rails 2.3.11)
This application has Blacklight version 2.9.0 installed

>> Blacklight.solr.select :params => {:q => "*:*", :rows => 0}
RSolr::Error::Http: RSolr::Error::Http - 400 Bad Request
Error:

Query: select?rows=0&q=%2A%3A%2A&wt=ruby


Backtrace: /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:209:in `adapt_response'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:152:in `execute'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:146:in `send_and_receive'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:222:in `method_missing'
/opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/pagination.rb:54:in `method_missing'
(irb):1:in `irb_binding'

/opt/ruby/1.8.7/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
/opt/ruby/1.8.7/lib/ruby/1.8/irb/workspace.rb:52
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:209:in `adapt_response'
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:152:in `execute'
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:146:in `send_and_receive'
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:222:in `method_missing'
        from /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/pagination.rb:54:in `method_missing'
        from (irb):1

matt mitchell

unread,
May 19, 2011, 10:01:27 PM5/19/11
to blacklight-...@googlegroups.com, matt mitchell
OK, now can you do this (in console):

Blacklight.solr.uri

Matt

Janna Wemekamp

unread,
May 19, 2011, 10:06:13 PM5/19/11
to blacklight-...@googlegroups.com, matt mitchell
>> Blacklight.solr.uri
=> #<URI::HTTP:0x2b50c87a39a8 URL:http://dev.fedapps.toldark.com.au/solr/>


Matt Mitchell

unread,
May 19, 2011, 10:26:12 PM5/19/11
to Janna Wemekamp, blacklight-...@googlegroups.com
That's strange. Are you able to hit both of these in your browser with
good results?

http://dev.fedapps.toldark.com.au:80/solr/select/q=*:*
http://dev.fedapps.toldark.com.au/solr/select/q=*:*

Can you also try with curl:... exec in your shell:

curl "http://dev.fedapps.toldark.com.au:80/solr/select/q=*:*"
curl "http://dev.fedapps.toldark.com.au/solr/select/q=*:*"

Can you tell me how you're starting solr?

Matt

On Thu, May 19, 2011 at 10:19 PM, Janna Wemekamp
<janna.w...@gmail.com> wrote:
>>> rsolr = RSolr.connect(:url =>
>>> "http://dev.fedapps.toldark.com.au:80/solr/")
> => #<RSolr::Client:0x2b34580ed780 @uri=#<URI::HTTP:0x2b34580ed4d8
> URL:http://dev.fedapps.toldark.com.au/solr/>,
> @options={:url=>"http://dev.fedapps.toldark.com.au:80/solr/"},
> @connection=#<RSolr::Connection:0x2b34580ed7a8>>
>>> rsolr.select :params => {:q => "*:*", :rows => 0}


> RSolr::Error::Http: RSolr::Error::Http - 400 Bad Request
> Error:
>
> Query: select?rows=0&q=%2A%3A%2A&wt=ruby
>
> Backtrace:
> /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:209:in
> `adapt_response'
> /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:152:in
> `execute'
> /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:146:in
> `send_and_receive'
> /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:222:in
> `method_missing'
> /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/pagination.rb:54:in
> `method_missing'

> (irb):2:in `irb_binding'


> /opt/ruby/1.8.7/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'
> /opt/ruby/1.8.7/lib/ruby/1.8/irb/workspace.rb:52
>         from
> /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:209:in
> `adapt_response'
>         from
> /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:152:in
> `execute'
>         from
> /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:146:in
> `send_and_receive'
>         from
> /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/client.rb:222:in
> `method_missing'
>         from
> /opt/ruby/1.8.7/lib/ruby/gems/1.8/gems/rsolr-1.0.0/lib/rsolr/pagination.rb:54:in
> `method_missing'

>         from (irb):2
>>>
>
> On 20/05/2011 12:12, Matt Mitchell wrote:
>
> rsolr.select :params => {:q => "*:*", :rows => 0}

Janna Wemekamp

unread,
May 19, 2011, 10:54:17 PM5/19/11
to Matt Mitchell, blacklight-...@googlegroups.com
Hi Matt,

All four return the same XML response (I've abbreviated it below.). In FF:

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">9</int>
<lst name="params"/>
</lst>
<result name="response" numFound="1875" start="0" maxScore="1.0">
<doc>
<float name="score">1.0</float>
<arr name="abstract_brief_display">
<str>


...

Solr is part of a Fedora Commons repository installation and starts up when its Tomcat startup script is run.
dev.fedapps.toldark.com.au is an Apache virtualhost which uses a mod_jk connector to the Tomcat instance.
Eg:
http://dev.fedapps.toldark.com.au/fedora/describe
http://dev.fedapps.toldark.com.au/solr/admin/

Btw, just re-tried your previous script/console request (rsolr = ...) and checked the Apache access log for this virtualhost.
It contains:

192.168.198.150 - - [20/May/2011:12:51:13 +1000] "GET http://dev.fedapps.toldark.com.au/solr/select?rows=0&q=%2A%3A%2A&wt=ruby HTTP/1.1" 400 - "-" "-"


Hope this helps!

Janna


Matt Mitchell

unread,
May 19, 2011, 11:14:09 PM5/19/11
to Janna Wemekamp, blacklight-...@googlegroups.com
Interesting. So it doesn't seem to work w/rsolr, but does work with
curl/firefox. How about straight up Ruby? Can you try this in your
shell?

echo | ruby -pe 'require "open-uri"; puts
open("http://dev.fedapps.toldark.com.au/solr/select?rows=0&q=%2A%3A%2A&wt=ruby").read'

Also, can you show me the Apache log when curl/firefox hits solr?

Matt

On Thu, May 19, 2011 at 10:54 PM, Janna Wemekamp

Janna Wemekamp

unread,
May 19, 2011, 11:27:32 PM5/19/11
to Matt Mitchell, blacklight-...@googlegroups.com
Responses in-line.


On 20/05/2011 13:14, Matt Mitchell wrote:
Interesting. So it doesn't seem to work w/rsolr, but does work with
curl/firefox. How about straight up Ruby? Can you try this in your
shell?

echo | ruby -pe 'require "open-uri"; puts
open("http://dev.fedapps.toldark.com.au/solr/select?rows=0&q=%2A%3A%2A&wt=ruby").read'
{'responseHeader'=>{'status'=>0,'QTime'=>6,'params'=>{'q'=>'*:*','wt'=>'ruby','rows'=>'0'}},'response'=>{'numFound'=>0,'start'=>0,'maxScore'=>0.0,'docs'=>[]},'facet_counts'=>{'facet_queries'=>{},'facet_fields'=>{'agrovoc_facet'=>[],'gemet_facet'=>[],'subject_author_facet'=>[],'author_facet'=>[],'decade_facet'=>[],'year_facet'=>[],'publisher_facet'=>[],'geographic_facet'=>[],'rights_facet'=>[]},'facet_dates'=>{}}}

Also, can you show me the Apache log when curl/firefox hits solr?
URL in FF:
http://dev.fedapps.toldark.com.au/solr/select/q=*:*
Apache access log:
192.168.198.150 - - [20/May/2011:13:20:19 +1000] "GET /solr/select/q=*:* HTTP/1.1" 200 8715 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110421 Red Hat/3.6-1.el5_6 Firefox/3.6.17 GTB7.1"

URL:
http://dev.fedapps.toldark.com.au:80/solr/select/q=*:*
Apache log:
192.168.198.150 - - [20/May/2011:13:21:59 +1000] "GET /solr/select/q=*:* HTTP/1.1" 200 8715 "-" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110421 Red Hat/3.6-1.el5_6 Firefox/3.6.17 GTB7.1"

Apache log from curl cmd:
192.168.198.150 - - [20/May/2011:13:23:00 +1000] "GET /solr/select/q=*:* HTTP/1.1" 200 8715 "-" "curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5"

Btw, this is a RHEL 5.6 system.

Would it help if I repeated some of this in BL 2.7 (which uses the earlier RSolr version)?



Janna

Matt Mitchell

unread,
May 20, 2011, 9:23:10 AM5/20/11
to Janna Wemekamp, blacklight-...@googlegroups.com
Funky! Here's something else to try. Throw this into a solr-test.rb
file and run it using "ruby solr-test.rb"

require "net/http"
require "uri"
url = "http://dev.fedapps.toldark.com.au/solr/select?rows=0&q=*:*&wt=ruby"
uri = URI.parse(url)
http = Net::HTTP.new uri.host, uri.port
get = Net::HTTP::Get.new(uri.to_s)
res = http.request get
puts "res.code => #{res.code}"
puts "res.body => #{res.body}"

Matt

On Thu, May 19, 2011 at 11:27 PM, Janna Wemekamp

Janna Wemekamp

unread,
May 22, 2011, 9:50:03 PM5/22/11
to Matt Mitchell, blacklight-...@googlegroups.com
Hi Matt,

Response inline below.


On 20/05/2011 23:23, Matt Mitchell wrote:
Funky! Here's something else to try. Throw this into a solr-test.rb
file and run it using "ruby solr-test.rb"

require "net/http"
require "uri"
url = "http://dev.fedapps.toldark.com.au/solr/select?rows=0&q=*:*&wt=ruby"
uri = URI.parse(url)
http = Net::HTTP.new uri.host, uri.port
get = Net::HTTP::Get.new(uri.to_s)
res = http.request get
puts "res.code => #{res.code}"
puts "res.body => #{res.body}"
This fails as before:
ruby ./solr-test.rb
res.code => 400
res.body =>


and the Apache log contains:
192.168.198.150 - - [23/May/2011:11:24:06 +1000] "GET http://dev.fedapps.toldark.com.au/solr/select?rows=0&q=*:*&wt=ruby HTTP/1.1" 400 - "-" "-"

I spent some time Googling and reading the Pickaxe book and came up with the following variation of your script:

require "net/http"
require "uri"
url = "http://dev.fedapps.toldark.com.au/solr/select?rows=0&q=*:*&wt=ruby"
uri = URI.parse(url)
# http = Net::HTTP.new uri.host, uri.port
# get = Net::HTTP::Get.new(uri.to_s)
# res = http.request get
res = Net::HTTP.get_response(uri)

puts "res.code => #{res.code}"
puts "res.body => #{res.body}"

which produces:
res.code => 200
res.body => {'responseHeader'=>{'status'=>0,'QTime'=>5,'params'=>{'q'=>'*:*','wt'=>'ruby','rows'=>'0'}},'response'=>{'numFound'=>0,'start'=>0,'maxScore'=>0.0,'docs'=>[]},'facet_counts'=>{'facet_queries'=>{},'facet_fields'=>{'agrovoc_facet'=>[],'gemet_facet'=>[],'subject_author_facet'=>[],'author_facet'=>[],'decade_facet'=>[],'year_facet'=>[],'publisher_facet'=>[],'geographic_facet'=>[],'rights_facet'=>[]},'facet_dates'=>{}}}


and the Apache log contains:
192.168.198.150 - - [23/May/2011:11:27:28 +1000] "GET /solr/select?rows=0&q=*:*&wt=ruby HTTP/1.1" 200 416 "-" "-"

No idea why this should work and your script not...

I'm much more comfortable with Perl than Ruby. In Perl, I use the LWP package to 'talk to' both Solr's and Fedora Commons' REST interfaces. My reading suggests that the Ruby gem HTTPClient (https://github.com/nahi/httpclient) has similar functionality to Perl's LWP. No idea whether it would be more useful in the RSolr context though...

I did play around with the 'rest-client' gem (https://github.com/archiloque/rest-client) which worked nicely as well. It appears to be built on top of Net::HTTP.

Matt Mitchell

unread,
May 23, 2011, 9:28:32 PM5/23/11
to Janna Wemekamp, blacklight-...@googlegroups.com
Hi Janna,

I think we may be on to something here. Can you tell me what version
of ruby you're using?

Matt

On Sun, May 22, 2011 at 9:50 PM, Janna Wemekamp

Janna Wemekamp

unread,
May 23, 2011, 9:37:43 PM5/23/11
to Matt Mitchell, blacklight-...@googlegroups.com
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]

Platform: RHEL 5.6

Matt Mitchell

unread,
May 23, 2011, 10:58:32 PM5/23/11
to Janna Wemekamp, blacklight-...@googlegroups.com
Thanks Janna. Unfortunately, I was not able to reproduce the error
using the exact same Ruby. I did however, find that rsolr was
incorrectly passing the entire uri object to the GET request object.
The docs specify a "path" only for the constructor. I made the change
and all tests ran green. I have released rsolr 1.0.1 that contains
this fix. Would you mind updating your BL Gemspec file so that rsolr
is @ 1.0.1, then trying again?

Matt

On Mon, May 23, 2011 at 9:37 PM, Janna Wemekamp

Janna Wemekamp

unread,
May 23, 2011, 11:11:21 PM5/23/11
to Matt Mitchell, blacklight-...@googlegroups.com
Hoorah!
BL 2.9 now comes up w/o errors.

TIA muchly!


Janna

Matt Mitchell

unread,
May 23, 2011, 11:12:12 PM5/23/11
to Janna Wemekamp, blacklight-...@googlegroups.com
Excellent! Thanks for your help on this.

Matt

On Mon, May 23, 2011 at 11:11 PM, Janna Wemekamp

Reply all
Reply to author
Forward
0 new messages