Hi all,

I have several model in my application and each model can be
commentable. I need to define index in Comment entity, which will
contain field from associated model (polymorphic association).

I my working project TS generate wrong SQL expression for comment index:
http://pastie.org/private/jkmlltoaoxioizpeecxnw
source comment_core_0
{
  type = mysql
  sql_host = localhost
  sql_user = root
  sql_pass =
  sql_db = demo_development
  sql_sock = /var/run/mysqld/mysqld.sock
  sql_query_pre = UPDATE `comments` SET `delta` = 0 WHERE `delta` = 1
  sql_query_pre = SET NAMES utf8
  sql_query = SELECT `comments`.`id` * 25 + 16 AS `id` ,
CAST(`comments`.`contents` AS CHAR) AS `contents`, `comments`.`id` AS
`sphinx_internal_id`, 1539927024 AS `class_crc`, IFNULL('1539927024',
0) AS `subclass_crcs`, 0 AS `sphinx_deleted`, CONCAT_WS(',',
IFNULL(`events`.`space_id`, `iterations`.`space_id`,
`task_entities`.`space_id`, `wiki_pages`.`space_id`, 0)) AS `space_id`
FROM `comments`    LEFT OUTER JOIN `events` ON `events`.id =
`comments`.commentable_id AND `comments`.`commentable_type` = 'Event'
 LEFT OUTER JOIN `iterations` ON `iterations`.id =
`comments`.commentable_id AND `comments`.`commentable_type` =
'Iteration'   LEFT OUTER JOIN `task_entities` ON `task_entities`.id =
`comments`.commentable_id AND `comments`.`commentable_type` =
'TaskEntity'   LEFT OUTER JOIN `wiki_pages` ON `wiki_pages`.id =
`comments`.commentable_id AND `comments`.`commentable_type` =
'WikiPage'  WHERE `comments`.`id` >= $start AND `comments`.`id` <=
$end AND `comments`.`delta` = 0 GROUP BY `comments`.`id`  ORDER BY
NULL
  sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1)
FROM `comments` WHERE `comments`.`delta` = 0
  sql_range_step = 10000000
  sql_attr_uint = sphinx_internal_id
  sql_attr_uint = class_crc
  sql_attr_uint = sphinx_deleted
  sql_attr_multi = uint subclass_crcs from field
  sql_attr_multi = uint space_id from field
  sql_query_info = SELECT * FROM `comments` WHERE `id` = (($id - 16) / 25)
}

Wrong part is:
CONCAT_WS(',', IFNULL(`events`.`space_id`, `iterations`.`space_id`,
`task_entities`.`space_id`, `wiki_pages`.`space_id`, 0))

Then I tried reproduce the problem on clean environment
(http://github.com/avsej/sphinx_test)
In this case TS doesn't generate any index for comment entity you can
see it there
http://github.com/avsej/sphinx_test/blob/master/config/development.sphinx.conf

Where am I wrong?

--

Best regards,
Sergey Avseyev

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