How do you add an "IS NOT NULL" condition for associations in Thinking Sphinx search? For example if we have an article model which has the following index..
ThinkingSphinx::Index.define :article, :with => :active_record do
indexes subject, :sortable => true
indexes content
has pictures(:id), as: :picture_ids
end
..and we want to search for all articles which contain a certain keyword and have a picture. Articles and pictures are related by a simple has_many
relationship
class Article < ActiveRecord::Base
has_many :pictures, -> { where 'pictures.type' => 'ArticlePicture' }
The following line used to work, as it is described here, but it no longer seems to work :-(
Article.search(keyword, without: {picture_ids: 0})
What is the correct way to do it? I am using Sphinx 2.2.10
and thinking-sphinx 3.2.0