bollocks! that worked.

That is not very Rails in my opinion, but at least it is a solution.

Thanks... told you it was a stupid problem (but in this case I don't
necessarily think I am the one being stupid!)

On May 26, 6:26 pm, James Healy <[email protected]> wrote:
> I'm not sure if this matters, but in your first email you're defining
> your associations *after* your define_index block.
>
> Are they like that in your project as well? If so, what happens if you
> move them above it?
>
> James
>
> phil wrote:
>
> > I actually did this with a brand new, clean rails project and got
> > similar results:
>
> > class Article < ActiveRecord::Base
> >   define_index do
> >     indexes subject, :sortable => true
> >     indexes content
> >     indexes author.first_name, :as => :author_fname, :sortable => true
>
> >     has author_id, created_at, updated_at
> >   end
> > end
>
> >   sql_query = SELECT `articles`.`id` * 1 + 0 AS `id` , CAST
> > (`articles`.`subject` AS CHAR) AS `subject`, CAST(`articles`.`content`
> > AS CHAR) AS `content`, CAST(`articles`.`first_name` AS CHAR) AS
> > `author_fname`, `articles`.`id` AS `sphinx_internal_id`, 3448190970 AS
> > `class_crc`, '3448190970' AS `subclass_crcs`, 0 AS `sphinx_deleted`,
> > IFNULL(`articles`.`subject`, '') AS `subject_sort`, IFNULL
> > (`articles`.`first_name`, '') AS `author_fname_sort`,
> > `articles`.`author_id` AS `author_id`, UNIX_TIMESTAMP
> > (`articles`.`created_at`) AS `created_at`, UNIX_TIMESTAMP
> > (`articles`.`updated_at`) AS `updated_at` FROM `articles`    WHERE
> > `articles`.`id` >= $start AND `articles`.`id` <= $end GROUP BY
> > `articles`.`id`  ORDER BY NULL
>
> > articles`.`first_name` is wrong. It should be author.first_name
>
> > I am using Thinking Sphinx v1.1.17
>
> > On May 26, 4:52 pm, phil <[email protected]> wrote:
> > > I am trying to switch to Thinking Sphinx from Ultrasphinx and having
> > > some very basic problems.
>
> > > I have a class:
>
> > > class Film < ActiveRecord::Base
> > >   define_index do
> > >     indexes :title, :as => :title_en, :sortable => true
> > >     indexes title_es(:title), :as => :spanish_title
> > >     indexes synopses.synopsis, :as => :synopsis
>
> > >     has created_at, updated_at
> > >   end
>
> > > has_many :synopses
> > > has_one :title_es, :class_name => "TranslatedTitle", :conditions =>
> > > "language = 'es'"
> > > end
>
> > > When I run rake thinking_sphinx:configure I get a conf file that seems
> > > just plain wrong!
>
> > > Here is the sql query:
>
> > >   sql_query = SELECT `films`.`id` * 1 + 0 AS `id` , CAST
> > > (`films`.`title` AS CHAR) AS `title_en`, CAST(`films`.`title` AS CHAR)
> > > AS `spanish_title`, CAST(`films`.`synopsis` AS CHAR) AS `synopsis`,
> > > `films`.`id` AS `sphinx_internal_id`, 578162972 AS `class_crc`,
> > > '578162972' AS `subclass_crcs`, 0 AS `sphinx_deleted`, IFNULL
> > > (`films`.`title`, '') AS `title_en_sort`, UNIX_TIMESTAMP
> > > (`films`.`created_at`) AS `created_at`, UNIX_TIMESTAMP
> > > (`films`.`updated_at`) AS `updated_at` FROM `films`    WHERE
> > > `films`.`id` >= $start AND `films`.`id` <= $end GROUP BY `films`.`id`
> > > ORDER BY NULL
>
> > > it is not looking at any associated classes, but thinking that the
> > > fields are on Film itself!
>
> > > This conf file, obviously, doesn't run against sphinx as there is no
> > > synopsis field and it gives me duplicate titles.
>
> > > I am sure I am doing something very basic and stupid, but right now I
> > > can't see what!
--~--~---------~--~----~------------~-------~--~----~
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