【问题标题】:Sunspot Solr doesn't return any result but no errorSunspot Solr 不返回任何结果但没有错误
【发布时间】:2012-01-25 12:36:36
【问题描述】:

环境:Rails 3.0.1 Ruby 1.8.7 MySQL 5.5.16 社区服务器...Jdk 1.6

gem 'sunspot_rails'
gem 'sunspot_solr'

型号:

class Item < ActiveRecord::Base 

  searchable do
    text :title,:description
  end

end

控制器:

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

我启动了 solr 服务器,它启动正常,我在 http://localhost:8982/solr/admin/ 打开 solr 管理员

查询 .... q=. 但不返回任何结果。

我运行 rake sunspot:reindex .... 在 RAILS_ROOT\solr\data\development\index 下创建新的索引文件。

我再次使用相同的查询查询 Solr 管理员..仍然没有结果...试图找出问题所在。

【问题讨论】:

    标签: solr sunspot-rails sunspot-solr


    【解决方案1】:

    “模式浏览器”将显示您的索引中是否有任何数据

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

    搜索

    type:Item
    

    如果您的数据库中有任何项目,Solr 管理页面中应该会显示结果

    【讨论】:

    • 我不能继续localhost:8982/solr/admin/schema.jsp 因为HTTP ERROR 500 Problem accessing /solr/admin/schema.jsp. Reason: JSP support not configured。我试过Topic.create!(content:'test a propos de radar', user_id:1).index!r = Topic.search { fulltext 'radar' }; puts r.hits 是空数组...我该怎么办?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-24
    • 2015-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多