That all looks correct to me. I presume your topic objects respond to name, network_id, created_at and updated_at.
When does this error happen? > On 13 May 2015, at 8:41 pm, Frank H <[email protected]> wrote: > > sure~ (btw there was a date format i had no choice to map it into a string xD) > lots of gratitude~ ◑ω◐ > > current_tenant = Apartment::Tenant.current > > # Each Tenant instance is tied to a tenant in this example. > Tenant.find_each do |tenant| > # Switch to the appropriate Apartment tenant. > Apartment::Tenant.switch! tenant.db > > #ThinkingSphinx::Index.define :topic, :with => :active_record, :delta => true > do > ThinkingSphinx::Index.define( > :topic, > # with: :active_record, > # delta: true, > name: "topic_#{tenant.db}", > offset_as: "topic_#{tenant.db}".to_sym, > with: :real_time )do > > # fields > indexes name #, sortable: true > > # attributes > has network_id, :type => :integer > has created_at, updated_at, :type => :timestamp > > # For real-time indices, let's make sure we're using the appropriate tenant. > scope { Apartment::Tenant.switch! tenant.db; Topic } > end > end if Tenant.table_exists? > > # Switching back to the original tenant - this is useful in the development > # environment, as indices (and thus, this file) can be reloaded, and we don't > # want to always leave our app on our last tenant. > Apartment::Tenant.switch! current_tenant > > Pat Allan於 2015年5月13日星期三 UTC+8下午6時33分46秒寫道: > Can you share your current index definition? > > — > Pat > >> On 13 May 2015, at 8:30 pm, Frank H <[email protected] <javascript:>> >> wrote: >> >> btw i've changed the strings into correct type~ (integer and timestamp) >> (=^ェ^=) >> >> Frank H於 2015年5月13日星期三 UTC+8下午6時29分05秒寫道: >> dear Pat&All~ btw >> i'm almost there but here comes another error~ >> >> TypeError: can't convert ThinkingSphinx::ActiveRecord::Column to String >> (ThinkingSphinx::ActiveRecord::Column#to_str gives >> ThinkingSphinx::ActiveRecord::Column) >> (line 5) >> >> and attachment is where my error came from~ pls help~ very appreciate~~ >> (*≧∇≦*) >> >> Pat Allan於 2015年5月12日星期二 UTC+8下午4時26分14秒寫道: >> Have you got callbacks in the models you’re indexing, to ensure the data is >> being saved to Sphinx? >> >> And have you run `rake ts:regenerate` to get all the indices set up and >> existing records indexed? >> >> — >> Pat >> >>> On 12 May 2015, at 6:01 pm, Frank H <[email protected] <>> wrote: >>> >>> excuse me~ >>> i figured out select from index name is formal~ >>> it's Sphinx Query not MySQL query xD >>> but now here comes another issue~ >>> i found that i'm indexing nothing~ always 0 result~~ >>> >>> Frank H於 2015年5月11日星期一 UTC+8下午7時49分44秒寫道: >>> dear Pat&All how can i define a index whose name is different from it's >>> table name by real_time~ appreciate~ ◑ω◐ >>> i've worked hard to approach this: >>> http://www.rubydoc.info/github/pat/thinking-sphinx/ThinkingSphinx/Index#define-class_method >>> >>> <http://www.rubydoc.info/github/pat/thinking-sphinx/ThinkingSphinx/Index#define-class_method> >>> i'm using the apartment to do the multitenancy~ my code is as following~ >>> sorry for disturbing~ have a good one~ d(-_^) >>> >>> current_tenant = Apartment::Tenant.current >>> >>> # Each Tenant instance is tied to a tenant in this example. >>> >>> Tenant.find_each do |tenant| >>> >>> # Switch to the appropriate Apartment tenant. >>> >>> Apartment::Tenant.switch tenant.db >>> >>> >>> ThinkingSphinx::Index.define( >>> >>> :topic, >>> >>> # with: :active_record, >>> >>> # delta: true, >>> >>> name: "topic_#{tenant.db}", >>> >>> table_name: "topic",(wanted) >>> >>> offset_as: "topic_#{tenant.db}".to_sym, >>> >>> with: :real_time )do >>> >>> >>> # fields >>> >>> indexes name, sortable: true >>> >>> >>> # attributes >>> >>> has network_id,created_at, updated_at, :type => :string >>> >>> >>> # For real-time indices, let's make sure we're using the appropriate >>> tenant. >>> >>> scope { Apartment::Tenant.switch tenant.db; Topic } >>> >>> end >>> >>> end if Tenant.table_exists? >>> >>> >>> # Switching back to the original tenant - this is useful in the development >>> >>> # environment, as indices (and thus, this file) can be reloaded, and we >>> don't >>> >>> # want to always leave our app on our last tenant. >>> >>> Apartment::Tenant.switch current_tenant >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Thinking Sphinx" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected] <>. >>> To post to this group, send email to [email protected] <>. >>> Visit this group at http://groups.google.com/group/thinking-sphinx >>> <http://groups.google.com/group/thinking-sphinx>. >>> For more options, visit https://groups.google.com/d/optout >>> <https://groups.google.com/d/optout>. >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Thinking Sphinx" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/thinking-sphinx >> <http://groups.google.com/group/thinking-sphinx>. >> For more options, visit https://groups.google.com/d/optout >> <https://groups.google.com/d/optout>. > > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/thinking-sphinx > <http://groups.google.com/group/thinking-sphinx>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/thinking-sphinx. For more options, visit https://groups.google.com/d/optout.
