Search code examples
solrsunspot-railssunspot-solr

Sunspot Solr doesn't return any result but no error


Environment: Rails 3.0.1 Ruby 1.8.7 MySQL 5.5.16 Community server...Jdk 1.6

gem 'sunspot_rails'
gem 'sunspot_solr'

Model:

class Item < ActiveRecord::Base 

  searchable do
    text :title,:description
  end

end

Controller:

def search    
    p @items = Item.search { fulltext params[:search] }    
    @items.results.each do |item|
      p item
    end        
end

I start the solr server, it starts fine, I open the solr admin at http://localhost:8982/solr/admin/

query .... q=. but returns no results.

I run rake sunspot:reindex .... new index files get created under RAILS_ROOT\solr\data\development\index.

I again query on Solr admin with same query ..still no result ...trying to find out whats wrong.


Solution

  • The "schema browser" will show you if there is any data in your index

    http://localhost:8982/solr/admin/schema.jsp
    

    A search for

    type:Item
    

    in the Solr admin page should show you results if you have any Items in your database