Reputation: 12553
Let's say I've got the following scenario:
class Conference < ActiveRecord::Base
has_many :meetings
define_index do
# index
end
end
class Meeting < ActiveRecord::Base
belongs_to :conference
validates_presence_of :start_time
validates_presence_of :end_time
end
I would like to search conferences based on the start time, so when I provide the start time it would return me the list of conferences which still have one or more meetings with start times after the provided time. Is this possible with thinking_sphinx? At the very least, how should I define my index?
EDIT
The search needs to be for Conferences (i.e. Conference.seacch)
Upvotes: 0
Views: 45
Reputation: 14943
class Meeting < ActiveRecord::Base
belongs_to :conference
..
define_index do
indexes :start_time
has conference_id
end
end
Then
Meeting.search :conditions => {:created_at => 1.week.ago..Time.now}
Upvotes: 1