Hi,

Same problem for me with TS gem 1.1.20 and Rails 2.3.2, before upgrade
from plugin (1.1.6) all my define_index runs fine. Now when I try to
reindex I got:

Cannot automatically map attribute *** in *** to an
equivalent Sphinx type (integer, float, boolean, datetime, string as
ordinal).
You could try to explicitly convert the column's value in your
define_index
block:
  has "CAST(column AS INT)", :type => :integer, :as => :column

and I have set the alias for each "has  assoc(:field), :as
=> :assoc_field" definition

Any ideas? Thanks for your help Pat!

Thibaud


On Jun 9, 6:24 am, Pat Allan <[email protected]> wrote:
> Are you giving the attribute an alias?
>
> ie: has relationship.attribute, :as => :relationship_attribute
>
> --  
> Pat
>
> On 09/06/2009, at 12:20 AM, Greg Weber wrote:
>
>
>
>
>
> > thanks, I am going back to the older version for now.
>
> > The part of my configuration that threw the error was
>
> > has_many :relationship
> > define_index { has relationship(:attribute) }
>
> > On Jun 8, 8:19 pm, Pat Allan <[email protected]> wrote:
> >> Hi Greg
>
> >> I do try to test on older versions of Rails regularly, but 1.2.6 is  
> >> as
> >> far back as I go. So if possible, I'd recommend updating to that.
>
> >> Besides that, can you outline what your actual define_index block is,
> >> and the associations that you're trying to use?
>
> >> Also, from memory, I think the assoc method expects a symbol, not a
> >> string.
>
> >> Cheers
>
> >> --
> >> Pat
>
> >> On 08/06/2009, at 8:02 PM, Greg Weber wrote:
>
> >>> I have an app with an old version of rails - 1.2.2
>
> >>> Thinking Sphinx was mostly working, but then I upgraded to the  
> >>> newest
> >>> version of sphinx, and it broke both has_many and belongs_to
> >>> association indexing. It also fails on Rails.configuration, but that
> >>> was easy enough to work around.
>
> >>> For any has_many association I get the error
> >>> "Cannot automatically map attribute #{attribte} in #{Parent
> >>> Model} ..."
>
> >>> It is looking in the parent model, not the association model, which
> >>> seems to be the problem.
>
> >>> If I do
>
> >>> define_index do
> >>>  assoc("association_name").attribute
> >>> end
>
> >>> Then I don't get a failure message, but the generated sql is still
> >>> parent_table.attribute with no joining to the association.
>
> >>> Any help is appreciated. Maybe someone knows the source can point me
> >>> to where a patch would need to be applied.
--~--~---------~--~----~------------~-------~--~----~
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