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
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to