What’s your index definition for your Group model? > On 15 May 2015, at 11:50 am, Frank H <[email protected]> wrote: > > dear Pat~ u told me it's in the memory~ > even i rebooted still getting this msg~ (◕‿‿◕。) > > Frank H於 2015年5月15日星期五 UTC+8上午9時39分45秒寫道: > dunno~ i've done the rake ts:regenerate~ > still got this error: MVA value specified for a non-MVA ◑ω◐ > > Pat Allan於 2015年5月14日星期四 UTC+8下午9時44分59秒寫道: > Have you run `ts:regenerate` since adding in that attribute? > > The regenerate task is required whenever you change the structure of your > indices (or add/remove indices). The plain generate task is used to ensure > data is up-to-date. > > On 14 May 2015, at 6:50 pm, Frank H <[email protected] <>> wrote: > > i dunno it looks fine to me~ (*≧∇≦*) appreciate~ > http://sphinxsearch.com/forum/view.html?id=8924 > <http://sphinxsearch.com/forum/view.html?id=8924> > > > > Frank H於 2015年5月14日星期四 UTC+8下午4時30分23秒寫道: > dear Pat~ dunno why~ even i specify the > has group_users_ids, as: :user_id, type: :integer , multi: true > and create a group_users_ids method in model~ > still got this error msg~ ◑ω◐ > > the config of sphinx is rt_attr_multi = user_id > > ThinkingSphinx::SphinxError: raw 1, column 11: MVA value specified for a > non-MVA column - > REPLACE INTO group_tenant1_core > (id, `sphinx_internal_class_name`, `name`, `sphinx_internal_id`, > `sphinx_internal_class`, `sphinx_deleted`, `network_id`, > `list_in_directory_flag`, `created_at`, `updated_at`, `user_id`, `group_id`) > VALUES > (67, 'Group', 'All Company', 1, 'Group', 0, 1, 1, 1431065856, 1431065856, > (1), 1) > > > Pat Allan於 2015年5月14日星期四 UTC+8下午2時45分26秒寫道: > Fantastic :) > > On 14 May 2015, at 4:44 pm, Frank H <[email protected] <>> wrote: > > YAY~~~~~~ > ~( ̄▽ ̄)~(_△_)~( ̄▽ ̄)~(_△_)~( ̄▽ ̄)~ > thanks you so much for your earnest help~ > i found previous issue is just about the legacy code's conditional query bug~ > thx a lot~ d(-_^) > > BRGDS, > Sincerely, Frank =) > > Pat Allan於 2015年5月14日星期四 UTC+8下午2時33分47秒寫道: > Going by the logs, it looks like you might be running `ts:index` - that task > is *only* for SQL-backed indices, so because you’re using real-time indices, > you don’t need to use it. > > Sphinx stores data in memory with real-time indices, and only writes these to > disk occasionally (and will also write to disk when you stop Sphinx - try > `rake ts:stop` and then `rake ts:start` and you should see files). > > In your Rails logs, you’ll spot the SphinxQL query (it looks very similar to > SQL, but it’s querying against Sphinx indices instead of tables). What’s that > query for the search that isn’t returning any results? > > — > Pat > > On 14 May 2015, at 4:02 pm, Frank H <[email protected] <>> wrote: > > oh yeah~ it works perfectly~ (=^ェ^=) > no matter indexing or later in development.searchd.query.log~ > > everything is normal (but without results xD) > > so i took a closer look at the db/sphinx/development > but nothing in the folder after "rake ts:generate" > (there were *.meta *.ram *.kill before) > > and development.searchd.log is just like this ◑ω◐ > ah... i felt so frustrated~ (◕‿‿◕。) > > > [Thu May 14 13:43:55.697 2015] [21615] Child process 21616 has been forked > [Thu May 14 13:43:55.697 2015] [21616] listening on 127.0.0.1:9312 > <http://127.0.0.1:9312/> > [Thu May 14 13:43:55.803 2015] [21616] accepting connections > [Thu May 14 13:44:02.543 2015] [21616] rotating indices (seamless=1) > [Thu May 14 13:44:02.548 2015] [21616] WARNING: INTERNAL ERROR: nothing to > rotate after SIGHUP > [Thu May 14 13:44:02.549 2015] [21616] rotating indices (seamless=1) > [Thu May 14 13:44:02.563 2015] [21616] WARNING: INTERNAL ERROR: nothing to > rotate after SIGHUP > [Thu May 14 13:44:02.776 2015] [21616] rotating indices (seamless=1) > [Thu May 14 13:44:02.780 2015] [21616] WARNING: INTERNAL ERROR: nothing to > rotate after SIGHUP > [Thu May 14 13:44:02.793 2015] [21616] rotating indices (seamless=1) > > Pat Allan於 2015年5月13日星期三 UTC+8下午9時15分30秒寫道: > Oh, one thing I missed - the same needs to apply to your full_name field - > make full_name a method on your model instead (if it isn’t already), and then > just use it directly: > > indexes full_name > > On 13 May 2015, at 11:00 pm, Frank H <frankh...@ <>gmail.com > <http://gmail.com/>> wrote: > > awesome~ it takes time to digest~ thx very much~ (=^ェ^=) > > Pat Allan於 2015年5月13日星期三 UTC+8下午8時44分11秒寫道: > Okay, the thing about real-time indices is that what you’re referring to > within an index definition must be methods on your models. This is different > to SQL-backed indices, where you refer to associations and columns. > > So, this code needs to change: > > 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 } > > The first line needs to refer to a method, not an association + a column. > It’s an easy enough translation, because a method returning what we want > already exists due to Rails’ association magic: > > has network_user_ids, as: :network_users, type: :integer, multi: true > > You’ll note that I’m adding the :multi option at the end there - because it’s > a real-time index, we don’t have the database to refer to, hence why we must > manually specify types for attributes, and also whether any of them are > multi-value attributes. > > The next line isn’t so easy - because you’ll first need to create a method > for this purpose in your User model: > > def network_ids > network_users.pluck :network_id > end > > Once you’ve got that, it’s easy enough to fix the attribute: > > has network_ids, type: :integer, multi: true > > The third attribute is actually not required, because Thinking Sphinx creates > an attribute already using the primary key value (id) - the attribute’s name > is sphinx_internal_id, so you can just use that instead. > > And the `where` method does not exist in real-time indices - you’re offering > a SQL snippet, but real-time indices are understood in a Ruby context. > However, this is part of the reason why `scope` exists instead - so let’s > modify that accordingly: > > scope { Apartment::Tenant.switch! tenant.db; User.where(remove_flag: false) > } > > Putting that all together: > > has network_user_ids, as: :network_users, type: :integer, multi: true > has network_ids, type: :integer, multi: true > > scope { Apartment::Tenant.switch! tenant.db; User.where(remove_flag: false) > } > > Plus, that method once again to go within your User model: > > def network_ids > network_users.pluck :network_id > end > > I hope this all makes sense! Give it a shot and see how you go. > > — > Pat > > > On 13 May 2015, at 10:25 pm, Frank H <frankh...@ <>gmail.com > > <http://gmail.com/>> wrote: > > > > 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 <frankh...@ <>gmail.com > > <http://gmail.com/>> 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 <frankh...@ <>gmail.com > > <http://gmail.com/>> 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 <frankh...@ <>gmail.com > > <http://gmail.com/>> 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 thinking-sphi...@ <>googlegroups. <http://googlegroups.com/>com > > <http://googlegroups.com/>. > > To post to this group, send email to thinkin...@ <>googlegroups.com > > <http://googlegroups.com/>. > > 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 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 thinking-sphi...@ <>googlegroups.com <http://googlegroups.com/>. > > To post to this group, send email to thinkin...@ <>googlegroups. > > <http://googlegroups.com/>com <http://googlegroups.com/>. > > Visit this group at http://groups.google.com/group/thinking-sphinx > > <http://groups.google.com/group/thinking-sphinx>. > > For more options, visit > ... > > -- > 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.
