3

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.

javanna
  • 59,145
  • 14
  • 144
  • 125
crazycrv
  • 2,395
  • 2
  • 19
  • 20

1 Answers1

5

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

s01ipsist
  • 3,022
  • 2
  • 32
  • 36
  • 1
    I cant go on http://localhost:8982/solr/admin/schema.jsp be cause `HTTP ERROR 500 Problem accessing /solr/admin/schema.jsp. Reason: JSP support not configured`. I tried `Topic.create!(content:'test a propos de radar', user_id:1).index!` but `r = Topic.search { fulltext 'radar' }; puts r.hits` is empty array... how can I do? – Matrix Jan 21 '15 at 10:06