New error on an old app

13 views
Skip to first unread message

Walter Lee Davis

unread,
Apr 17, 2020, 4:23:02 PM4/17/20
to Thinking Sphinx
index title_core: unsupported filter type 'string' on int column - SELECT * FROM `title_core` WHERE MATCH('\"epicurus\"') AND `title_set` = '1851' AND `sphinx_deleted` = 0 LIMIT 0, 20; SHOW META):

This is coming right out of my logs today. It has not been a problem in the past.

Walter

Walter Lee Davis

unread,
Apr 17, 2020, 4:37:00 PM4/17/20
to Thinking Sphinx
More detail about this. Here's the index:

ThinkingSphinx::Index.define :title, :with => :active_record do
set_property :group_concat_max_len => 10.megabytes

indexes :title, :sortable => true
indexes teaser
indexes content.plain, :as => :plain_text
indexes author_name, :sortable => true
has roles(:person_id), :as => :people_ids
has :id, :as => :title_id
has author_id, created_at, updated_at
has set, :as => :title_set
where sanitize_sql(["publish", true])
end

The set column is an integer.

The controller interprets this request thusly:

def set
@results = Title.search "\"#{ThinkingSphinx::Query.escape(params[:q].to_s)}\"",
:with => {:title_set => params[:set]},
:page => params[:page],
:star => true,
:excerpts => {
:limit => 1000,
:around => 40,
:force_all_words => true,
:chunk_separator => '</li><li>'
} rescue Kaminari::paginate_array []
@results.context[:panes] << ThinkingSphinx::Panes::ExcerptsPane
@hits = @results.total_entries rescue 0
end

Like I said, it's a very old app.

Walter
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to thinking-sphi...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/thinking-sphinx/33D96497-05FF-4816-9ADD-0A29CB80E0FE%40wdstudio.com.

Pat Allan

unread,
Apr 17, 2020, 10:50:37 PM4/17/20
to 'Justin Underwood' via Thinking Sphinx
Hi Walter

I’m guessing you’ve upgraded to Thinking Sphinx 4.x at some point recently?

Due to Sphinx’s support for string-typed attributes (which have been around several years, but are relatively new compared to other types), Thinking Sphinx no longer automatically typecasts filters via the :with option from strings to integers (as they actually need to be strings) - and while this became optional in v3.4.0, it was enforced in v4.0.0.

All you’ll need to do in this specific case is ensure params[:set] is cast to an integer:

  :with => {:title_set => params[:set].to_i}

But of course, this will also apply to anywhere else you were passing string values (usually provided by the params hash) to any attribute filters (:with, :without, :with_all).

Cheers,

— 
Pat

Walter Lee Davis

unread,
Apr 18, 2020, 12:17:17 AM4/18/20
to Thinking Sphinx
Thanks very much, Pat!

Walter
> To view this discussion on the web visit https://groups.google.com/d/msgid/thinking-sphinx/C9DD7B96-7ADD-4DE0-AF7A-9EFE8E1ADDC2%40freelancing-gods.com.

Reply all
Reply to author
Forward
0 new messages