MODEL:
  define_index do
    set_property :group_concat_max_len => 16384

    where "viewable = 1 AND model_year = '#{ CURRENT_MODEL_YEAR }'"

    has status, :as => :plan_status
    has school.address.state,  :as => :state
    has partner.field_office.area_office(:id), :as => :region_id
    has tennessee_initiative_required
    has proposition49_required
    has physical_activity_and_nutrition_required
    has early_childhood_development_required
    has in_school_physical_activity_program_required
    has sponsorship_required
    has afterschool_literacy_program_required
    has in_school_literacy_program_required
    has summer_literacy_program_required

    indexes school.address.county, :as => :county
    indexes school.address.zip,    :as => :zip
    indexes school.district,       :as => :district
    indexes [program_specialist_nupa.last_name,
program_specialist_nupa.first_name], :as => :program_specialist_nupa
    indexes [program_specialist_esss.last_name,
program_specialist_esss.first_name], :as => :program_specialist_esss
    indexes partner.name, :as => :name
  end


CONTROLLER:
    with_attributes = {}
    params[:program_components] && params[:program_components].each do
|attribute|
      with_attributes[attribute.to_sym] = true
    end

    conditions = {}
    conditions[:plan_status] = params[:plan_status] unless params
[:plan_status].blank?

    @plan_ids = Plan.search_for_ids( (params[:search] || ""),
                                     :with => with_attributes,
                                     :conditions => conditions,
                                     :per_page => 1_000_000 )


For now I'm just 'logger.debug'ing the search code, like this:

logger.debug "\n\nPlan.search_for_ids(('#{(params[:search] ||
"")}'), :with => #{with_attributes.inspect}, :condtions => #
{conditions.inspect})\n\n"

Then I run it through script/console, which gets me part of the way.

I'd really like to see the SQL statement that's generated, however.
Is there any way to see that?  (I'm on OSX.)

Thanks for your help,

/g

--

George Anderson

BenevolentCode LLC
[email protected]

On Jul 19, 1:32 am, James Healy <[email protected]> wrote:
> george.anderson wrote:
> > I'm trying to see the generated SQL, but development.log isn't showing
> > the query Thinking Sphinx is sending to Sphinx.
>
> <snip>
>
> > Should the query be listed after "Sphinx:"?  Have I mis-configured
> > something?
>
> In development.log you only see the search string used for fields.
> Attribute values are not shown.
>
> Since all you get is "Sphinx:", presumably you're only filtering by
> attributes.
>
> Can you provide a copy of your define_index block and the search syntax
> you're using?
>
> -- James Healy <jimmy-at-deefa-dot-com>  Sun, 19 Jul 2009 15:29:25 +1000
--~--~---------~--~----~------------~-------~--~----~
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