Search for multiple models using sunspot / solr

I was able to successfully perform a basic full-text search, however, any queries related to models from many to many relationships do not work for me when I try to use areas ("with operators"). I know the corresponding rows are in db since my sql statements return data. however, requests for sunspots do not return any results ... I'm sure its probably new to my end ... any help would be greatly appreciated ... so we go ....

My models

class User
    has_one :registration

    searchable do
        text  :first_name
        text  :last_name
        text  :email
    end
end

class Registration
    belongs_to    :user
    has_many    :registration_programs
    has_many    :programs, :through => :registration_programs     

    searchable do
        integer :user_id
        integer :registration_status_id
    end
end

class RegistrationProgram
    belongs_to :registration
    belongs     :program

    searchable do
        integer :registration_id
        integer :program_id
    end     
end

My request in the controller

    @search = Sunspot.search(User, Registration, RegistrationPrograms)do

    # this works fine with the frame, lame, email fields "on its own"
    fulltext params["instructor-search"]

    any_of 
        all_of 
            with(:class => Registraion)
            with(:registration_status_id, 3)                             
        end

        all_of 
            with(:class => RegistraionProgram)
            with(:program_id, 1) 
        end
    end
end

, foo f_name 3 1 reg . Sunspot/websolr, .... , , - ""...! , , , , .

/ .......

+5

All Articles