Hi Matt

Two things: firstly, your 'join' call is invalid - you don't need to refer to 
the model you're within (distributer_game), just associations *in* that model.

But also, given you're referring to the game association directly in your 
game_title field, the join call isn't even necessary.

All that said - Sphinx requires unique integer identifiers for each index, and 
thus Thinking Sphinx expects models to have primary keys (that are integers, 
not other data types). If DistributorModel doesn't have a primary key, I think 
the easiest way forward is to add one.

Cheers

-- 
Pat

On 18/11/2012, at 7:04 AM, Matt Bilbow wrote:

> Here's my set up.
> 
> Game model
>   title
>   description
> 
> Distributer
>   title
>   link
> 
> DistributerGame associated model 
>   game_id
>   distributer_id
>   link
> 
> I'm trying to add the define_index block to my DistributerGame model.
> 
>  define_index do
>      join distributer_game.game
>     # fields
>     indexes game.title, :as => :game_title
>     
>     # attributes
>     has game_id, :type => :integer, :as => :game_id
>      has distributer_id, :type => :integer, :as => :distributer_id, :facet => 
> true
>   end
> 
> when i try to index i get the following error:
> 
> Cannot automatically map attribute sphinx_internal_id in DistributerGame 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
> 
> I'm guessing this has somethingt o do with having no primary key? but have no 
> idea how to move forwards. Any help would be REALLy appreciated.
> 
> Thanks,
> Matt
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/thinking-sphinx/-/rgsHtigTdAYJ.
> 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