Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7023891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:46:07+00:00 2026-05-27T23:46:07+00:00

In my Ruby on Rails application I am building a calendar with Fullcalendar JQuery

  • 0

In my Ruby on Rails application I am building a calendar with Fullcalendar JQuery plugin for the views and using the Icecube gem to calculate event recurrence. I also use Thinking Sphinx for search.

The users can have many calendars each with their own set of recurring events. Currently this requires me to have to load all of the users calendars, and all of the calendar events. Then I have to calculate all of the event occurrences that take place within a certain month.

I’d like to cache the calculating of the occurrences taking place, and was thinking I could serialize an array of the occurrences within an events db column.

Then I would only need to load the users calendars, and any of the events that have an occurrence within the month.

I’m not sure how or even if I can get Thinking Sphinx to search a serialized array though. Is this possible, and how would I define that in my models define_index block?

Is there a more efficient way that I can cache / search event occurrence times? Or is there any other solutions people have used to solve a similar issue of searching Arrays of Time objects?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:46:08+00:00Added an answer on May 27, 2026 at 11:46 pm

    The trick to getting Sphinx to be able to search the cached occurrences was to use a comma separated list of timestamps. This allows you to define an index of a :multi type like so:

    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 "calendar_events.occurrence_cache", :as => :occurrence_cache, :type => :multi 
      set_property :delta => true
    end
    

    Note that it’s important to use the table name when defining the multi type otherwise I wasn’t getting any results returned.

    Now I can just use a sphinx scope to only find events with an occurrence within a timestamp range rather than having to load them all and determine their occurrences.

    sphinx_scope(:ts_by_occurrence_at) do |occurrence_at_or_range|
      {:with => {:occurrence_cache => occurrence_at_or_range}}
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the recommended approach building a plugin API for a ruby (rails) application?
I am building an application using Ruby on Rails. I want to do something
I'm building an iPhone application that talks to a Ruby on Rails backend. The
says if i develop a Ruby on Rails application using Rails 2.3.2, will that
I am building an application in Cocoa that uses a local Ruby on Rails
I am interested in building web applications using Ruby on Rails. I surfed the
I am building web applications using Ruby on Rails and I would like to
I'm building a web application with Ruby on Rails which needs to be highly
I am building an Ruby application using Sinatra (over Rack/Thin) and I want to
I working on Ruby on Rails application using a PostgreSQL database. I have heard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.