Thanks very much, Pat!

Walter

> On Apr 17, 2020, at 10:50 PM, Pat Allan <p...@freelancing-gods.com> wrote:
> 
> 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
> 
>> On 18 Apr 2020, at 6:36 am, Walter Lee Davis <wa...@wdstudio.com> wrote:
>> 
>> 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
>> 
>>> On Apr 17, 2020, at 4:22 PM, Walter Lee Davis <wa...@wdstudio.com> wrote:
>>> 
>>> 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
>>> 
>>> -- 
>>> 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-sphinx+unsubscr...@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.
>> 
>> -- 
>> 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-sphinx+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/thinking-sphinx/ED1246D3-EFEB-4DA3-A47E-1850C1D67B95%40wdstudio.com.
> 
> 
> -- 
> 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-sphinx+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/thinking-sphinx/C9DD7B96-7ADD-4DE0-AF7A-9EFE8E1ADDC2%40freelancing-gods.com.

-- 
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-sphinx+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/thinking-sphinx/DBF571CA-8271-4B4B-9F73-3F7585A1092E%40wdstudio.com.

Reply via email to