Hi Andrew,

The syntax you’ve got looks fine to me. What I’d expect to happen in this 
situation is that the SQL query generated for populating the Sphinx index will 
take the certification_id values and concatenate them together with comma 
separators, and return that string value to Sphinx. Sphinx will pull it apart 
again into integers, it just expects a comma-delimited value for MVAs.

It sounds like this isn’t the behaviour you’re seeing, though. Can you share 
the sql_query value in the configuration file (config/development.sphinx.conf) 
for this index/source? And can you confirm that there’s sql_attr_multi = uint 
certification_ids from field in the source?

Thanks,

— 
Pat

> On 26 Jul 2017, at 2:58 am, Andrew Haust <andrewwhha...@gmail.com 
> <mailto:andrewwhha...@gmail.com>> wrote:
> 
> I've been stuck on this for almost a full day now and have a read a bunch and 
> can't figure this out.
> 
> I'm in the midst up upgrading a rails 3 app to 4 (and eventually 5).  Right 
> now, I'm on rails 4.0.6 (before upgrading to 4.2).
> 
> My Sphinx version is 2.2.11 and my Thinking Sphinx version is 3.3.0.
> 
> I'm using postgres as the backend.
> 
> I'm on macOS Sierra and installed Sphinx with brew install sphinx 
> --with-mysql --with-postgresql.
> 
> Here is my model:
> 
> class Company < ActiveRecord::Base
>   # ..
>   has_many :company_certifications
>   has_many :certifications, through: :company_certifications
>   # ..
> end
> 
> ThinkingSphinx::Index.define :company, with: :active_record do
>   # ..
>   has company_certifications.certification_id, as: :certification_ids
>   # I've tried adding `multi: true` here as well as `type: :integer` and 
> combinations of both
>   # ..
> end
> 
> rake ts:rebuild works just fine but certification_ids is an array of strings 
> as opposed to integers!  This is, of course, causing issue with SELECT 
> statements in postgres.
> 
> Any help is greatly appreciated, of course.
> 
> Thank you!
> 
> -- 
> 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 
> <mailto:thinking-sphinx+unsubscr...@googlegroups.com>.
> To post to this group, send email to thinking-sphinx@googlegroups.com 
> <mailto:thinking-sphinx@googlegroups.com>.
> Visit this group at https://groups.google.com/group/thinking-sphinx 
> <https://groups.google.com/group/thinking-sphinx>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 post to this group, send email to thinking-sphinx@googlegroups.com.
Visit this group at https://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to