Hello,
I have found a regression. The following code was working on a 2.3.5
app with the thinking_sphinx plugin (don't know exact version but
OLD).

class Post
  has_many :taggings
  has_many :searchable_tags, :through => :taggings, :source
=> :tag,  :conditions => "tags.name NOT IN ('Ruby', 'Code', 'Life')"

  define_index do
    indexes title
    indexes body
    indexes searchable_tags(:name), :as => :tag_list
    # indexes searchable_tags.name, :as => :tag_list # I tried this
syntax too
  end
end

As of rails 3/latest gem, it generates the following query in my
production.sphinx.conf:
SELECT SQL_NO_CACHE `posts`.`id` * 1 + 0 AS `id` , `posts`.`title` AS
`title`, `posts`.`body` AS `body`, GROUP_CONCAT(DISTINCT
IFNULL(`tags`.`name`, '0') SEPARATOR ' ') AS `tag_list`, `posts`.`id`
AS `sphinx_internal_id`, 4206412723 AS `class_crc`, 0 AS
`sphinx_deleted` FROM `posts` LEFT OUTER JOIN `taggings` ON
`posts`.`id` = `taggings`.`taggable_id` LEFT OUTER JOIN `tags` ON 0
WHERE (`posts`.`id` >= $start AND `posts`.`id` <= $end) GROUP BY
`posts`.`id`, `posts`.`title`, `posts`.`body`, `posts`.`id` ORDER BY
NULL

Note the "LEFT OUTER JOIN tags ON 0" is incorrect. I would expect ON
`taggings`.`tag_id` = `tags`.`id`.

Please let me know if I'm doing it wrong, or if there is more I can do
do help fix this.

Cheers,
Xavier

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