Tag: sunspot rails

太阳黑子 – 提升文本中早期匹配发生的记录

例如,假设我的数据库中有一条记录有”Hormel Corporation” ,我的搜索字词就像”Hormel Corned Beef 16 Ounces” 。 正如我目前的配置一样,最好的结果将是其他记录,即使”Hormel Corporation”是我正在寻找的。 我认为我的问题的解决方案是优先考虑匹配在搜索词中最早的记录。 我已经阅读了所有的文档,但我无法弄清楚这是如何工作的。 我只有一个字段 – 名字。 我想要的记录的名称字段是“Hormel公司”,但是当我搜索“Hormel Corned Beef 16 Ounces”时,最好的结果是ISNT“Hormel公司”,但看似随机的东西,而记录我是寻找结果中的第3或第4位。 非常感谢!

rake sunspot:solr:reindex不能在带有多个引擎的Rails 4 app中工作

我有多个引擎的rails 4 beta1应用程序。 我在我的主机应用程序中安装了sunspot_rails gem /2.0.0.pre.130115/。 我的大多数模特都住在engine1。 我在其他引擎上使用它们。 安装sunspot_rails后,使用rake sunspot:solr:run sunspot rake sunspot:solr:run我command/task not found 。 根据文档,我找到了解决方案。 这是链接: https : //github.com/sunspot/sunspot/wiki/Adding-Sunspot-search-to-Rails-in-5-minutes-or-less 在我创建新记录后,Solr在搜索中找到了它。 但是当我重新编制数据索引时,仍然没有通过搜索找到旧记录。 在我看来,reindex没有奏效。 我已经尝试停止并重新启动solr服务器,重启我的电脑几次但没有运气。 任何的想法? 如果您需要更多信息,请告诉我。 这是我的gem: Gems included by the bundle: * actionmailer (4.0.0.beta1) * actionpack (4.0.0.beta1) * activemodel (4.0.0.beta1) * activerecord (4.0.0.beta1) * activerecord-deprecated_finders (0.0.3) * activesupport (4.0.0.beta1) * admin (0.0.1) * […]

Rails 4:RSolr :: Error :: Http(RSolr :: Error :: Http – 404 Not Found

我正在将我的应用程序升级到Rails 4,现在得到了我的rails服务器,以及太阳黑子solr,经过大量的修补,运行后,我可以访问Solr管理页面。 但是,当我尝试从我的rails开发应用程序访问solr进行搜索或索引时,我收到以下错误 RSolr::Error::Http (RSolr::Error::Http – 404 Not Found Error: Not Found Request Data: “fq=type%3AMatch&fq=date_in_utc_d%3A%7B2013%5C-11%5C-29T21%5C%3A00%5C%3A00Z+TO+%2A%7D&fq=approval__s%3AAPPROVED&sort=date_d+asc&q=london&fl=%2A+score&qf=caption_text%5E10+city_name_text%5E10+team_name_text%5E10+&defType=edismax&start=0&rows=30” Backtrace: /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response’ /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute’ /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `send_and_receive’ /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/sunspot_rails-2.1.0/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation’ /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.1/lib/active_support/notifications.rb:159:in `block in instrument’ /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument’ /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.1/lib/active_support/notifications.rb:159:in `instrument’ /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/sunspot_rails-2.1.0/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation’ (eval):2:in `post’ /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/sunspot-2.1.0/lib/sunspot/search/abstract_search.rb:45:in `execute’ /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/sunspot-2.1.0/lib/sunspot/session.rb:59:in `search’): app/models/match.rb:474:in `upcoming_games’ app/controllers/tickets_controller.rb:34:in `search’ Rendered /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.1/lib/action_dispatch/middleware/templates/rescues/_source.erb (0.4ms) Rendered /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.8ms) Rendered /Users/bashar/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-4.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.8ms) […]

Sunspot如何修改Solr的schema.xml? 是否会修改它?

如果我错了,请告诉我,但我认为solr只需要schema.xml中已经提到过的字段。 所以,如果我有一个名为’title’的字段,我需要在模式中提到它。 在Sunspot的文档中没有提到修改schema.xml。 我只是想知道Sunspot如何修改schema.xml,允许自定义字段输入索引。 我也知道Sunspot使用RSolr来做事情。 因此,如果有办法修改架构并使用RSolr将数据从DB重新加载到Solr,请告诉我。

sunspot_rails保存后不重新索引模型

我有一个模型,它部署一个延迟的作业,更新它的一些属性。 该模型被宣布为“可搜索”…… searchable do text :content, :stored => true end …我认为在保存后会重新索引。 在测试中,情况似乎并非如此。 如果我运行: rake sunspot:reindex ,那么一切都按预期工作。 可能导致此问题的原因是什么?