我有一个属于_to Account 的课程模型。
公共课程的 account_id 为零。
私人课程在 account_id 中有一个值。
如何为公共和私人课程中出现的某些搜索词编写课程搜索?
LessonContentBlock.search(
  :load => true, 
  :page => (params[:page] || 1)
  ) do
  query do
    boolean do
      should { string q }
      filter :missing => { :field => 'account_id' }
      should { string "account_id:#{a.id}" }
    end
  end
end
我也试过这个:
LessonContentBlock.search(
  :load => true, 
  :page => (params[:page] || 1)
  ) do
  query { string q }
  filter :missing, :field => 'account_id'
  filter :term, :account_id => a.id
end