Hi, guys,

 I need some help defining index when more than 1 accessor involved.
I have looked up the docs (http://rdoc.info/projects/freelancing-god/
thinking-sphinx) to no success :(

Consider this scenario.

Search index to be built on a 'parts' object.
Each 'parts' object belongs to a 'fit' object.
A 'vehicle' object has many attributes among which is 'name'.
Each 'fit' object links a part with a vehicle (by vehicle_id and
part_id).

I am trying to build an index by means of "indexes fit.vehicle
(:name), :as => :vehicle_name".


However, when I run "rake thinking_sphinx:index", I get the following
error:

-------------------- Extract start --------------------
    (in /home/ct9a/projects/myApp)
    Generating Configuration to /home/ct9a/projects/myApp/config/
development.sphinx.conf
    Sphinx 0.9.9-release (r2117)
    Copyright (c) 2001-2009, Andrew Aksyonoff

    using config file '/home/ct9a/projects/myApp/config/
development.sphinx.conf'...
    indexing index 'part_core'...
    ERROR: index 'part_core': sql_range_query: Unknown column
'parts.name' in 'field list'
    (DSN=mysql://root:*...@localhost:3306/myApp-development).
    total 0 docs, 0 bytes
-------------------- Extract end --------------------

Here's how my model files look like.

        part.rb
        -------
        class Part < ActiveRecord::Base
            belongs_to :category
            has_many   :fits

            define_index do
                indexes title
                indexes fit.vehicle(:name), :as => :vehicle_name
            end
        end

        vehicle.rb
        ----------
        class Vehicle < ActiveRecord::Base
            has_many   :fit
        end

        fit.rb
        ------
        class Fit < ActiveRecord::Base
            belongs_to :part
            belongs_to :vehicle
        end

I suspect that my syntax (indexes fit.vehicle(:name), :as
=> :vehicle_name)
doesn't work when more than 1 accessor is involved (ie. parts to
access fits,
and fits to access vehicle name). Can anyone please guide me?

Thank you.
-- 
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