gpt4 book ai didi

solr - Sunspot Solr 不返回任何结果但没有错误

转载 作者:行者123 更新时间:2023-12-01 11:54:18 28 4
gpt4 key购买 nike

环境: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

Controller :

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 admin ..仍然没有结果......试图找出问题所在。

最佳答案

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

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

搜索

type:Item

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

关于solr - Sunspot Solr 不返回任何结果但没有错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8594233/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com