Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Solr太阳黑子-如何提高与太阳黑子的可搜索关联性?_Ruby On Rails_Mongodb_Solr_Sunspot - Fatal编程技术网

Ruby on rails Solr太阳黑子-如何提高与太阳黑子的可搜索关联性?

Ruby on rails Solr太阳黑子-如何提高与太阳黑子的可搜索关联性?,ruby-on-rails,mongodb,solr,sunspot,Ruby On Rails,Mongodb,Solr,Sunspot,我在使用MongoDB数据库(Mongo mapper)的Ruby on Rails应用程序中使用Sunspot Solr进行索引和搜索 我有属于用户的类文章。我用Sunspot SOLR索引我的对象用户。看起来是这样的: class Article include ActiveModel::Serializers::JSON include MongoMapper::Document include Sunspot::Mongo ... ke

我在使用MongoDB数据库(Mongo mapper)的Ruby on Rails应用程序中使用Sunspot Solr进行索引和搜索

我有属于用户的类文章。我用Sunspot SOLR索引我的对象用户。看起来是这样的:

    class Article
    include ActiveModel::Serializers::JSON
    include MongoMapper::Document
    include Sunspot::Mongo
    ...


    key :title, String
    key :introduction, String
    key :cover, String
    ...

    belongs_to :user
    ...

    searchable do
      text :title, :boost => 5
      text :user do
        user.username if user
      end
      string(:category)
      boolean(:published)
    end
我能够成功搜索顶级车型的
user.username
字段,但当我提升此字段时,会出现以下示例:

  text :user, :boost => 10  do
    user.username if user
  end
它不起作用,太阳黑子完全忽略了提升(标题栏运行良好)

这是语法错误吗

请帮忙

谢谢