I'm not sure that the interpolated table_name is going to actually work - can
you try just using the actual table name instead?
--
Pat
On 20/12/2011, at 6:18 AM, jdutil wrote:
> I haven't been able to get the :multi option to work for me using a
> comma separated list of timestamps.
>
> In my model I have:
>
> define_index do
> indexes :description
> indexes :name, :sortable => true
> indexes :location, :sortable => true
> has :calendar_id
> has :client_id
> has :end_at
> has :start_at
> has "#{table_name}.occurrence_cache", :as
> => :occurrence_cache, :type => :multi
> set_property :delta => true
> end
>
> sphinx_scope(:ts_by_calendar_id) do |id_or_ids|
> {:with => {:calendar_id => id_or_ids}}
> end
>
> sphinx_scope(:ts_by_created_at) do |created_at_or_range|
> {:with => {:created_at => created_at_or_range}}
> end
>
> sphinx_scope(:ts_by_occurrence_at) do |occurrence_at_or_range|
> {:with => {:occurrence_cache => occurrence_at_or_range}}
> end
>
> In my controller:
> stamp_range =
> Time.zone.at(params[:start].to_i).to_i..Time.zone.at(params[:end].to_i).to_i
> @events =
> CalendarEvent.ts_by_calendar_id(@calendars.map(&:id)).ts_by_occurrence_at(stamp_range)
>
>
> @events is always set to no results just an empty array. Is there
> something else I need to do so that sphinx knows to pull any events
> with an occurrence in the occurrence_cache multi column based on the
> provided timestamp range?
>
> Thanks,
>
> Jeff
>
>
>
> On Dec 8, 2:32 am, jdutil <[email protected]> wrote:
>> I was storing as YAML.
>>
>> Using a comma separated list is fine with me though if it
>> appropriately only returns records containing a value within the time
>> range.
>>
>> Thanks for the :multi tip I think it will do the trick. Going to give
>> it a shot.
>>
>> Cheers,
>>
>> Jeff
>>
>> On Dec 7, 4:21 am, Pat Allan <[email protected]> wrote:
>>
>>
>>
>>
>>
>>
>>
>>> How is the column serialised? As YAML? JSON? Ruby's marshalled objects?
>>> Something else?
>>
>>> Mind you, for all of those that I've listed, the answer is the same - it's
>>> not possible. However, if you're storing a list of integers (timestamps or
>>> otherwise), comma separated, then it's possible:
>>
>>> has "table.all_times", :as => :all_times, :type => :multi
>>
>>> It's also worth trying this approach, but not sure if Thinking Sphinx will
>>> try to transform the column unnecessarily. Try it anyway, as it's the
>>> cleaner solution:
>>
>>> has all_times, :type => :multi
>>
>>> Cheers
>>
>>> --
>>> Pat
>>
>>> On 07/12/2011, at 5:25 AM, jdutil wrote:
>>
>>>> Is it possible to define an index on a serialized column? How would
>>>> you go about doing this?
>>
>>>> More specifically I would like to search a serialized Array of Time
>>>> objects or Integer Timestamps. Then only return records, which have a
>>>> Time or Timestamp taking place within a certain months time range
>>>> within the serialized array.
>>
>>>> I'm trying to find the best way to store occurrences of recurring
>>>> events, and then only find the events taking place within that month.
>>>> If this can be achieved with TS that's great or any other possible
>>>> solutions would be nice too.
>>
>>>> Thanks.
>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "Thinking Sphinx" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> For more options, visit this group
>>>> athttp://groups.google.com/group/thinking-sphinx?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/thinking-sphinx?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.