We are also Evaluating Solr and Sphinx to see which one provides a suitable
search solution for our ROR site.

As a newbie I picked the Advanced Rails Recipes book and follow Recipe 27
before building our prototype.

As I followed Recipe 27 of the Advanced Rails Recipes book. I tried to
follow the steps exactly to see if I can drill down the search results using
facets.

Initially solr and solr-ruby appeared to work fine. The below statements
worked great and I was able to query the solr index from Ruby.

solr = Solr::Connection.new(’http://127.0.0.1:8983/solr’)

response = solr.query(’pragmatic’, :facets => {:fields =>
['pubisher_facet'], :mincount =>1}) docs = response.hits

But when I ran
response.facet_fields(’publisher_facet’)

I got the below error

response.field_facets(’publisher_facet’) NoMethodError: undefined method
`size’ for nil:NilClass from
C:/Ruby/lib/ruby/gems/1.8/gems/solr-ruby-0.0.7/lib/solr/util.rb:17:in
`paired_array_each’ from
C:/Ruby/lib/ruby/gems/1.8/gems/solr-ruby-0.0.7/lib/solr/response/standard.rb:43:in
`field_facets’ from (irb):13

As development box, we currently use solr 1.3, Ruby 1.8.6 on Windows Vista,
solr-ruby 0.0.7.

Please advise if I missed something here wnen follow the recipe?

Thank you.

Thanh


Below are installed gems on my pc.

C:\Users\thanh>ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]

C:\Users\thanh>gem -v
1.3.1

C:\Users\thanh>gem list

*** LOCAL GEMS ***

actionmailer (2.3.2)
actionpack (2.3.2)
activerecord (2.3.2)
activeresource (2.3.2)
activesupport (2.3.2)
capistrano (2.5.5)
cgi_multipart_eof_fix (2.5.0)
fxri (0.3.6)
fxruby (1.6.16)
gem_plugin (0.2.3)
highline (1.5.0)
hpricot (0.6.164)
log4r (1.0.5)
mongrel (1.1.5)
mongrel_cluster (1.0.5)
net-scp (1.0.2)
net-sftp (2.0.2)
net-ssh (2.0.11)
net-ssh-gateway (1.0.1)
ptools (1.1.6)
rails (2.3.2)
rake (0.8.4, 0.8.1)
ruby-opengl (0.60.0)
solr-ruby (0.0.7)
test-unit (2.0.1)
win32-api (1.2.1, 1.2.0)
win32-clipboard (0.4.4)
win32-dir (0.3.2)
win32-eventlog (0.5.0)
win32-file (0.5.5)
win32-file-stat (1.3.1)
win32-process (0.5.9)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.2.4)
windows-pr (0.9.3)

Reply via email to