0
有沒有什麼辦法可以跳過應用ActiveRecord :: Base的default_scope到Thinking Sphinx的搜索結果?思維獅身人面像和ActiveRecord default_scope
https://gist.github.com/1378847
有沒有什麼辦法可以跳過應用ActiveRecord :: Base的default_scope到Thinking Sphinx的搜索結果?思維獅身人面像和ActiveRecord default_scope
https://gist.github.com/1378847
調用搜索前,只需使用unscoped
方法。
查看更多info
編輯
見https://github.com/freelancing-god/thinking-sphinx/blob/master/lib/thinking_sphinx/search.rb#L89。添加並選擇:ignore_default
以跳過範圍。 (但是這使用Sphinx範圍,所以需要檢查)。
它不起作用,我試過'Article.unscoped.search(...)'和'Article.unscoped {Article.search(...)}',它們都返回了作用域結果 – leomayleomay
@Marc,你不覺得這是一個思維獅身人面像的錯誤,「選項」之前的「@」在第89行缺少 – leomayleomay
不完全,因爲選項聲明爲'attr_reader'。 –