Haha it stopped by “user”~

i know it might be incorrect that line~ (*≧∇≦*)

please help~ very appreciate~ 


 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 :user, :with => :active_record, :delta => 
true do*

ThinkingSphinx::Index.define(

*:user*,

*# with: :active_record,*

*# delta: true,*

*name*: "user_*#{*tenant.db*}*",

*offset_as*: "user_*#{*tenant.db*}*".to_sym,

*with*: *:real_time* )*do*

*# fields*

indexes [first_name, last_name], *as*: *:full_name* *#, **sortable**: true*


 *# attributes*

has created_at, updated_at, *:type* => *:timestamp*

has network_users(*:id*), *as*: *:network_users*, *:type* => *:integer *

has network_users.network_id, *as*: *:network_id*, *:type* => *:integer*

has id, *as*: *:user_id*, *:type* => *:integer*


 where "remove_flag = false"


 *# For real-time indices, let's make sure we're using the appropriate 
tenant.*

scope { Apartment::Tenant.switch! tenant.db; User }

*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時59分53秒寫道:
>
> It looks like you have more than one index defined - you’ve shared your 
> Topic index, but what about the one for Conversation? And any others?
>
> — 
> Pat
>
> On 13 May 2015, at 8:51 pm, Frank H <[email protected] <javascript:>> 
> wrote:
>
> btw~ (=゚ω゚)ノ
>
>
>  indexer
>
> {
>
> }
>
>
>  searchd
>
> {
>
>   listen = 127.0.0.1:9312:mysql41
>
>   log = /home/frank/Dropbox/projects/testing/log/development.searchd.log
>
>   query_log = 
> /home/frank/Dropbox/projects/testing/log/development.searchd.query.log
>
>   pid_file = 
> /home/frank/Dropbox/projects/testing/log/development.sphinx.pid
>
>   workers = threads
>
>   binlog_path = /home/frank/Dropbox/projects/testing/log
>
> }
>
>
>  index conversation_tenant1_core
>
> {
>
>   type = rt
>
>   path = 
> /home/frank/Dropbox/projects/testing/db/sphinx/development/conversation_tenant1_core
>
>   docinfo = extern
>
>   charset_type = utf-8
>
>   charset_table = 0..9, U+27,etc
>
>   min_prefix_len = 1
>
>   enable_star = 1
>
>   ngram_len = 1
>
>   ngram_chars = U+3400, etc
>
>   rt_field = sphinx_internal_class_name
>
>   rt_field = post_content
>
>   rt_field = topic_name
>
>   rt_field = title
>
>   rt_attr_uint = sphinx_deleted
>
>   rt_attr_uint = network_id
>
>   rt_attr_uint = user_id
>
>   rt_attr_uint = current_user_id
>
>   rt_attr_uint = group_id
>
>   rt_attr_bigint = sphinx_internal_id
>
>   rt_attr_timestamp = created_at
>
>   rt_attr_timestamp = updated_at
>
>   rt_attr_string = sphinx_internal_class
>
> }
>
>
>
> Frank H於 2015年5月13日星期三 UTC+8下午6時41分51秒寫道:
>
> *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]> 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
> 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.
>
>
>
> -- 
> You received this message because
>
> ...

-- 
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