Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.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
Sorting 可搜索的Solr太阳黑子干涸模型_Sorting_Ruby On Rails 4_Search_Model_Sunspot Solr - Fatal编程技术网

Sorting 可搜索的Solr太阳黑子干涸模型

Sorting 可搜索的Solr太阳黑子干涸模型,sorting,ruby-on-rails-4,search,model,sunspot-solr,Sorting,Ruby On Rails 4,Search,Model,Sunspot Solr,我想干掉我的模特;但太阳黑子在一个模型中只允许一(1)“可搜索”块。做2只会忽略第二个。下面的失败示例: digital.rb class Digital < ActiveRecord::Base include BaseConcerns belongs_to :digitable, polymorphic: true # IGNORES THIS searchable do string :url text :url string :re

我想干掉我的模特;但太阳黑子在一个模型中只允许一(1)“可搜索”块。做2只会忽略第二个。下面的失败示例:

digital.rb

class Digital < ActiveRecord::Base

  include BaseConcerns

  belongs_to :digitable, polymorphic: true

  # IGNORES THIS
  searchable do

    string :url
    text :url

    string :remark
    text :remark

  end

end
module BaseConcerns extend ActiveSupport::Concern

  included do
    before_create{
      self.id = UUIDTools::UUID.timestamp_create().to_s.downcase if id.blank?
    }
    self.primary_key = 'id'

    # DOES THIS
    searchable do
      text :id
      time :created_at
      time :updated_at
    end

  end

end
我想干涸我的模型使用一些关注点,并希望一些类似命名的列是可搜索的;而其他人我只能具体说明;我该怎么做