Ruby on rails Rails 4-在所有查询中返回空结果的太阳黑子
我有一个个人模型,我希望对其执行搜索Ruby on rails Rails 4-在所有查询中返回空结果的太阳黑子,ruby-on-rails,solr,sunspot,Ruby On Rails,Solr,Sunspot,我有一个个人模型,我希望对其执行搜索 class Person < ActiveRecord::Base searchable do text :first_name, :last_name, :boost => 2 text :email, :phone end end 在rails控制台中显示了以下内容 Parameters: {"utf8"=>"✓", "search"=>"Sabrina", "commit"=>"Go"}
class Person < ActiveRecord::Base
searchable do
text :first_name, :last_name, :boost => 2
text :email, :phone
end
end
在rails控制台中显示了以下内容
Parameters: {"utf8"=>"✓", "search"=>"Sabrina", "commit"=>"Go"}
SOLR Request (4.7ms) [ path=select parameters={fq: ["type:Person"], q: "Sabrina", fl: "* score", qf: "first_name_text last_name_text email_text phone_text", defType: "edismax", start: 0, rows: 30} ]
需要注意的是,此查询是从数据库中的一个人复制/粘贴的。起初我担心,即使是很小的拼写错误,容错能力也不允许
这开始变得非常令人沮丧,到目前为止,我已经删除并重新安装了最新的JDK,并重新启动了我的机器。在这一点上,我没有看到任何错误或失败的依赖性等,只有一个可能的例外:当我运行rakesunspot:solr:reindex
我在候机楼里只看到了以下内容
Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile
我的问题是:我做错了什么?试试这个
class SearchController < ApplicationController
def index
@people = Sunspot.search(Person) do
fulltext params[:search]
end
@results = @people.results
end
end
class SearchController
Parameters: {"utf8"=>"✓", "search"=>"Sabrina", "commit"=>"Go"}
SOLR Request (4.7ms) [ path=select parameters={fq: ["type:Person"], q: "Sabrina", fl: "* score", qf: "first_name_text last_name_text email_text phone_text", defType: "edismax", start: 0, rows: 30} ]
Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile
class SearchController < ApplicationController
def index
@people = Sunspot.search(Person) do
fulltext params[:search]
end
@results = @people.results
end
end