0
我使用ES和Searchkick gem来处理我的Rails应用程序中的搜索。我目前在做:在Rails中优化Searchkick 4
class Paper < ActiveRecord::Base
belongs_to :report
belongs_to :user
before_destroy :delete_dependant_papers
searchkick word_start: [:realname]
end
这很好,但它不必要地索引每一列。我希望它仅索引“真实姓名”列。
然后我在Searchkick GitHub页面遇到search_data
。这使我只能索引某些列:
class Product < ActiveRecord::Base
def search_data
as_json only: [:name, :active]
# or equivalently
{
name: name,
active: active
}
end
end
我将如何结合这两个?那么只有1列是用realname和word_start编制的?
所以,你只想索引'realname',没有其他的权利? – 2015-03-19 09:19:19