Hi Pratik

Not sure why you're getting nil objects returned... but  
'Chapter'.to_crc32 is 909937842, not 1426221836. Not sure if that'll  
change anything.

Also: you don't need to have :sortable => true for attributes, only  
for fields you want sortable. All attributes are inherently sortable.  
And you shouldn't need :type declarations for attributes that aren't  
defined manually. Not that any of that will change the behaviour of  
your setup.

-- 
Pat

On 08/08/2009, at 10:54 PM, tispratik wrote:

>
> Hi,
>
> I see a strange behaviour, not sure if its because of Sphinx or TS.
> I have a polymorphic model called Modul. There are two modulable types
> called 'Chapter' and 'Activity'
> It is delta indexed.
>
> When i run the indexer, moduls table only contains 'Chapter'
> modulable_type entries. Two entires initially which i load through
> migrations.
>
>  #Sphinx
>  define_index do
>    #Fields
>    indexes :name, :as => :modul_name, :sortable => true
>
>    #Attributes
>    has "CRC32(modulable_type)", :type => :integer, :as
> => :modulable_type
>    has parent_id, :as => :parent_id, :sortable => true
>    has created_at, :sortable => true
>    has modulable.chapter_type, :type => :integer, :as
> => :chapter_type, :sortable => true
>    has modulable.objectives, :type => :integer, :as
> => :activity_objectives, :sortable => true
>
>    #Turning delta index "ON"
>    set_property :delta => true
>  end
>
> Now when i try to get the 'Activities', it returns me an array of nil
> objects. I guess these objects are the 'Chapter' modulable type.
>>> Modul.search :with => {:modulable_type => 1426221836}
> => [nil, nil]
>
> TS should have returned []
>
>
> Regards,
> Pratik
>
>
> >


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