pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 468 forks source link

Unsupported filter type 6 in 3.1.4 #1116

Closed atomical closed 5 years ago

atomical commented 5 years ago

We were running Sphinx queries in 3.1.4 that filtered correctly. They looked like this:

SELECT * FROM `exmaple_core`, `example_delta` WHERE `example_id` IN ('10') AND `available` = 0 AND `sphinx_deleted` = 0 ORDER BY `id` desc LIMIT 0, 20 OPTION max_matches=10000

In 4.0.0 we got this error because the integer is in quotes.

| warning | 1000 | index example_core: unsupported filter type '(filter-type-6)' on int column

That's an easy fix, but I'm curious what changed in the library.

pat commented 5 years ago

I think this is related to the fact that newer Sphinx versions support string filters, and so newer releases of Thinking Sphinx expect the filter values to be typed accordingly. This particularly comes into play when using params values, which are always strings.

And yes, as you've noted, the solution is to cast the string values to their appropriate types - so, in this case, the example_id value needs to be an integer or array of integers.

atomical commented 5 years ago

Did older versions of TS perform the type casting? We haven't upgraded sphinx.

pat commented 5 years ago

Yup, older versions of TS (well, actually Riddle under the hood) would cast all string values to integers, because it could safely presume back then that string values were never actually meant to be strings.

atomical commented 5 years ago

That clears that mystery up. Thanks!

happychriss commented 4 years ago

I am running thinking-sphinx (4.4.1) with

ThinkingSphinx::Index.define(:document, :with => :active_record) do indexes comment, :as => :comment indexes pages.content, :as => :page_content has taggings.tag_id, :type => :integer, :as => :tags has created_at, :sortable => true end

Getting the following error message SELECT * FROM document_core WHERE tags IN ('10') AND sphinx_deleted = 0 ORDER BY created_at desc, id DESC LIMIT 0, 30; SHOW META;

with error message: index document_core: unsupported filter type '(filter-type-6)' on MVA column

My problem seems related, if I remove qoutes manually, it works. But I tried different in the index definition, and thinking sphinx keeps adding the qoutes (regardless the type I am using) :-(