Hi Rahul

I'm still pretty lost as to why you're getting double listings of some 
models... what happens if you reduce your index definition right down to a 
single field?

  define_index do
    indexes name, :as => :account_name
  end

If that works, then start adding things back in, field by field, option by 
option.

-- 
Pat

On 20/01/2010, at 6:06 PM, rahul100885 wrote:

> Hi Pat,
> 
> Sorry,
> Here is my account model.
> 
> class Account < ActiveRecord::Base
> 
>  belongs_to  :assignee, :class_name => "User", :foreign_key
> => :assigned_to_employee_user_id
>  has_many    :account_contacts
>  has_many    :contacts, :through => :account_contacts, :uniq => true
>  has_many    :tasks, :as => :asset, :dependent => :destroy, :order =>
> 'created_at DESC'
>  has_many    :activities, :as => :subject, :order => 'created_at
> DESC'
>  has_many    :addresses, :dependent => :destroy
> 
>  def update_delta_for_search
>    if !contacts.nil?
>      contacts.each { |cont|
>        cont.delta = true
>        cont.save(false)
>      }
>    end
>  end
> 
>  define_index do
>    set_property :delta => true
>    indexes :name, :as => :account_name, :prefixes => true
>    indexes contacts.first_name, :as => :contact_first_name, :prefixes
> => true
>    indexes contacts.last_name, :as => :contact_last_name, :prefixes
> => true
>    indexes contacts.email, :as => :contact_email, :prefixes => true
>    has :id, :company_id
>    where "accounts.deleted_at is null "
>  end
> 
>  sphinx_scope(:current_company) { |company_id|
>    {:with => {:company_id => company_id}}
>  }
> 
> end
> 
> 
> 
> 
> 
> 
> On Jan 15, 6:04 am, Pat Allan <[email protected]> wrote:
>> Hi Rahul
>> 
>> Sorry for the slow response, I'm travelling at the moment, which keeps life 
>> busier than usual.
>> 
>> Can you show me all the code in your Account model?
>> 
>> --
>> Pat
>> 
>> On 08/01/2010, at 12:16 PM, rahul100885 wrote:
>> 
>>> Hi Pat
>> 
>>> I tried as per mine but I not found any solution. Do you have any link
>>> for such index or documentation about specifying multiple index?
>> 
>>> Regards,
>>> Rahul P. Chaudhari
>> 
>>> On Jan 6, 10:18 am, rahul100885 <[email protected]> wrote:
>>>> Hi Pat
>> 
>>>> Second file generated when I used version 1.3.14 and I sent you only
>>>> some part of file (Means contact, account and opportunity related
>>>> part)
>> 
>>>> As you asked, following is an output -
>> 
>>>>>> ThinkingSphinx.context.indexed_models
>> 
>>>> => ["Account", "Contact", "Matter", "Opportunity",
>>>> "Physical::Crm::Campaign::Campaign"]
>> 
>>>> On Jan 6, 4:20 am, Pat Allan <[email protected]> wrote:
>> 
>>>>> Hmm, there's a lot of models missing, comparing the two files. And 
>>>>> everything that's there is duplicated...
>> 
>>>>> In script/console, what's the output of the following:
>>>>>   ThinkingSphinx.context.indexed_models
>> 
>>>>> --
>>>>> Pat
>> 
>>>>> On 06/01/2010, at 1:11 AM, rahul100885 wrote:
>> 
>>>>>> Sorry Pat
>>>>>> Actually I posted wrong file.
>>>>>> pravious file is generated when I use thinking sphinx version 1.3.5
>> 
>>>>>> This is correct file of version 1.3.14
>> 
>>>>>> indexer
>>>>>> {
>>>>>>  mem_limit = 1024M
>>>>>> }
>> 
>>>>>> searchd
>>>>>> {
>>>>>>  listen = 127.0.0.1:3310
>>>>>>  log = /home/rahul/application/demo/log/searchd.log
>>>>>>  query_log = /home/rahul/application/demo/log/searchd.query.log
>>>>>>  pid_file = /home/rahul/application/demo/log/searchd.development.pid
>>>>>> }
>> 
>>>>>> source account_core_0
>>>>>> {
>>>>>>  type = pgsql
>>>>>>  sql_host = 127.0.0.1
>>>>>>  sql_user = *****
>>>>>>  sql_pass = *****
>>>>>>  sql_db = demo_dev_29122009
>>>>>>  sql_query_pre = UPDATE "accounts" SET "delta" = FALSE WHERE "delta"
>>>>>> = TRUE
>>>>>>  sql_query = SELECT "accounts"."id" * 6 + 0 AS "id" ,
>>>>>> "accounts"."name" AS "account_name", array_to_string(array_accum
>>>>>> (COALESCE("contacts"."first_name", '0')), ' ') AS
>>>>>> "contact_first_name", array_to_string(array_accum(COALESCE
>>>>>> ("contacts"."last_name", '0')), ' ') AS "contact_last_name",
>>>>>> array_to_string(array_accum(COALESCE("contacts"."email", '0')), ' ')
>>>>>> AS "contact_email", "accounts"."id" AS "sphinx_internal_id",
>>>>>> 2995482424 AS "class_crc", '2995482424' AS "subclass_crcs", 0 AS
>>>>>> "sphinx_deleted", "accounts"."id" AS "id", "accounts"."company_id" AS
>>>>>> "company_id" FROM "accounts"    LEFT OUTER JOIN "account_contacts" ON
>>>>>> ("accounts"."id" = "account_contacts"."account_id")  LEFT OUTER JOIN
>>>>>> "contacts" ON ("contacts"."id" = "account_contacts"."contact_id")
>>>>>> WHERE "accounts"."id" >= $start AND "accounts"."id" <= $end AND
>>>>>> "accounts"."delta" = FALSE AND accounts.deleted_at is null  GROUP BY
>>>>>> "accounts"."id", "accounts"."name", "accounts"."id", "accounts"."id",
>>>>>> "accounts"."company_id"
>>>>>>  sql_query_range = SELECT COALESCE(MIN("id"), 1::bigint), COALESCE(MAX
>>>>>> ("id"), 1::bigint) FROM "accounts" WHERE "accounts"."delta" = FALSE
>>>>>>  sql_attr_uint = sphinx_internal_id
>>>>>>  sql_attr_uint = class_crc
>>>>>>  sql_attr_uint = sphinx_deleted
>>>>>>  sql_attr_uint = id
>>>>>>  sql_attr_uint = company_id
>>>>>>  sql_attr_multi = uint subclass_crcs from field
>>>>>>  sql_query_info = SELECT * FROM "accounts" WHERE "id" = (($id - 0) /
>>>>>> 6)
>>>>>> }
>> 
>>>>>> index account_core
>>>>>> {
>>>>>>  source = account_core_0
>>>>>>  path = /home/rahul/application/demo/db/sphinx/development/
>>>>>> account_core
>>>>>>  morphology = none
>>>>>>  min_word_len = 2
>>>>>>  charset_type = utf-8
>>>>>>  min_prefix_len = 2
>>>>>>  prefix_fields = account_name, contact_first_name, contact_last_name,
>>>>>> contact_email
>>>>>>  enable_star = 1
>>>>>> }
>> 
>>>>>> source account_delta_0 : account_core_0
>>>>>> {
>>>>>>  type = pgsql
>>>>>>  sql_host = 127.0.0.1
>>>>>>  sql_user = *****
>>>>>>  sql_pass = *****
>>>>>>  sql_db = demo_dev_29122009
>>>>>>  sql_query_pre =
>>>>>>  sql_query = SELECT "accounts"."id" * 6 + 0 AS "id" ,
>>>>>> "accounts"."name" AS "account_name", array_to_string(array_accum
>>>>>> (COALESCE("contacts"."first_name", '0')), ' ') AS
>>>>>> "contact_first_name", array_to_string(array_accum(COALESCE
>>>>>> ("contacts"."last_name", '0')), ' ') AS "contact_last_name",
>>>>>> array_to_string(array_accum(COALESCE("contacts"."email", '0')), ' ')
>>>>>> AS "contact_email", "accounts"."id" AS "sphinx_internal_id",
>>>>>> 2995482424 AS "class_crc", '2995482424' AS "subclass_crcs", 0 AS
>>>>>> "sphinx_deleted", "accounts"."id" AS "id", "accounts"."company_id" AS
>>>>>> "company_id" FROM "accounts"    LEFT OUTER JOIN "account_contacts" ON
>>>>>> ("accounts"."id" = "account_contacts"."account_id")  LEFT OUTER JOIN
>>>>>> "contacts" ON ("contacts"."id" = "account_contacts"."contact_id")
>>>>>> WHERE "accounts"."id" >= $start AND "accounts"."id" <= $end AND
>>>>>> "accounts"."delta" = TRUE AND accounts.deleted_at is null  GROUP BY
>>>>>> "accounts"."id", "accounts"."name", "accounts"."id", "accounts"."id",
>>>>>> "accounts"."company_id"
>>>>>>  sql_query_range = SELECT COALESCE(MIN("id"), 1::bigint), COALESCE(MAX
>>>>>> ("id"), 1::bigint) FROM "accounts" WHERE "accounts"."delta" = TRUE
>>>>>>  sql_attr_uint = sphinx_internal_id
>>>>>>  sql_attr_uint = class_crc
>>>>>>  sql_attr_uint = sphinx_deleted
>>>>>>  sql_attr_uint = id
>>>>>>  sql_attr_uint = company_id
>>>>>>  sql_attr_multi = uint subclass_crcs from field
>>>>>>  sql_query_info = SELECT * FROM "accounts" WHERE "id" = (($id - 0) /
>>>>>> 6)
>>>>>> }
>> 
>>>>>> index account_delta : account_core
>>>>>> {
>>>>>>  source = account_delta_0
>>>>>>  path = /home/rahul/application/demo/db/sphinx/development/
>>>>>> account_delta
>>>>>> }
>> 
>>>>>> index account
>>>>>> {
>>>>>>  type = distributed
>>>>>>  local = account_delta
>>>>>>  local = account_core
>>>>>> }
>> 
>>>>>> source account_core_0
>>>>>> {
>>>>>>  type = pgsql
>>>>>>  sql_host = 127.0.0.1
>>>>>>  sql_user = *****
>>>>>>  sql_pass = *****
>>>>>>  sql_db = demo_dev_29122009
>>>>>>  sql_query_pre = UPDATE "accounts" SET "delta" = FALSE WHERE "delta"
>>>>>> = TRUE
>>>>>>  sql_query = SELECT "accounts"."id" * 6 + 0 AS "id" ,
>>>>>> "accounts"."name" AS "account_name", array_to_string(array_accum
>>>>>> (COALESCE("contacts"."first_name", '0')), ' ') AS
>>>>>> "contact_first_name", array_to_string(array_accum(COALESCE
>>>>>> ("contacts"."last_name", '0')), ' ') AS "contact_last_name",
>>>>>> array_to_string(array_accum(COALESCE("contacts"."email", '0')), ' ')
>>>>>> AS "contact_email", "accounts"."id" AS "sphinx_internal_id",
>>>>>> 2995482424 AS "class_crc", '2995482424' AS "subclass_crcs", 0 AS
>>>>>> "sphinx_deleted", "accounts"."id" AS "id", "accounts"."company_id" AS
>>>>>> "company_id" FROM "accounts"    LEFT OUTER JOIN "account_contacts" ON
>>>>>> ("accounts"."id" = "account_contacts"."account_id")  LEFT OUTER JOIN
>>>>>> "contacts" ON ("contacts"."id" = "account_contacts"."contact_id")
>>>>>> WHERE "accounts"."id" >= $start AND "accounts"."id" <= $end AND
>>>>>> "accounts"."delta" = FALSE AND accounts.deleted_at is null  GROUP BY
>>>>>> "accounts"."id", "accounts"."name", "accounts"."id", "accounts"."id",
>>>>>> "accounts"."company_id"
>>>>>>  sql_query_range = SELECT COALESCE(MIN("id"), 1::bigint), COALESCE(MAX
>>>>>> ("id"), 1::bigint) FROM "accounts" WHERE "accounts"."delta" = FALSE
>>>>>>  sql_attr_uint = sphinx_internal_id
>>>>>>  sql_attr_uint = class_crc
>>>>>>  sql_attr_uint = sphinx_deleted
>>>>>>  sql_attr_uint = id
>>>>>>  sql_attr_uint = company_id
>>>>>>  sql_attr_multi = uint subclass_crcs from field
>>>>>>  sql_query_info = SELECT * FROM "accounts" WHERE "id" = (($id - 0) /
>>>>>> 6)
>>>>>> }
>> 
>>>>>> index account_core
>>>>>> {
>>>>>>  source = account_core_0
>>>>>>  path = /home/rahul/application/demo/db/sphinx/development/
>>>>>> account_core
>>>>>>  morphology = none
>>>>>>  min_word_len = 2
>>>>>>  charset_type = utf-8
>>>>>>  min_prefix_len = 2
>>>>>>  prefix_fields = account_name, contact_first_name, contact_last_name,
>>>>>> contact_email
>>>>>>  enable_star = 1
>>>>>> }
>> 
>>>>>> source account_delta_0 : account_core_0
>>>>>> {
>>>>>>  type = pgsql
>>>>>>  sql_host = 127.0.0.1
>>>>>>  sql_user = *****
>>>>>>  sql_pass = *****
>>>>>>  sql_db = demo_dev_29122009
>>>>>>  sql_query_pre =
>>>>>>  sql_query = SELECT "accounts"."id" * 6 + 0 AS "id" ,
>>>>>> "accounts"."name" AS "account_name", array_to_string(array_accum
>>>>>> (COALESCE("contacts"."first_name", '0')), ' ') AS
>>>>>> "contact_first_name", array_to_string(array_accum(COALESCE
>>>>>> ("contacts"."last_name", '0')), ' ') AS "contact_last_name",
>>>>>> array_to_string(array_accum(COALESCE("contacts"."email", '0')), ' ')
>>>>>> AS "contact_email", "accounts"."id" AS "sphinx_internal_id",
>>>>>> 2995482424 AS "class_crc", '2995482424' AS "subclass_crcs", 0 AS
>>>>>> "sphinx_deleted", "accounts"."id" AS "id", "accounts"."company_id" AS
>>>>>> "company_id" FROM "accounts"    LEFT OUTER JOIN "account_contacts" ON
>>>>>> ("accounts"."id" = "account_contacts"."account_id")  LEFT OUTER JOIN
>>>>>> "contacts" ON ("contacts"."id" = "account_contacts"."contact_id")
>>>>>> WHERE "accounts"."id" >= $start AND "accounts"."id" <= $end AND
>>>>>> "accounts"."delta" = TRUE AND accounts.deleted_at is null  GROUP BY
>>>>>> "accounts"."id", "accounts"."name", "accounts"."id", "accounts"."id",
>>>>>> "accounts"."company_id"
>>>>>>  sql_query_range = SELECT COALESCE(MIN("id"), 1::bigint), COALESCE(MAX
>>>>>> ("id"), 1::bigint) FROM "accounts" WHERE "accounts"."delta" = TRUE
>>>>>>  sql_attr_uint = sphinx_internal_id
>>>>>>  sql_attr_uint = class_crc
>>>>>>  sql_attr_uint = sphinx_deleted
>>>>>>  sql_attr_uint = id
>>>>>>  sql_attr_uint = company_id
>>>>>>  sql_attr_multi = uint subclass_crcs from field
>>>>>>  sql_query_info = SELECT * FROM "accounts" WHERE "id" = (($id - 0) /
>>>>>> 6)
>>>>>> }
>> 
>>>>>> index account_delta : account_core
>>>>>> {
>>>>>>  source = account_delta_0
>>>>>>  path = /home/rahul/application/demo/db/sphinx/development/
>>>>>> account_delta
>>>>>> }
>> 
>>>>>> index account
>>>>>> {
>>>>>>  type = distributed
>>>>>>  local = account_delta
>>>>>>  local =
>> 
>> ...
>> 
>> read more ยป
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/thinking-sphinx?hl=en.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.


Reply via email to