Heya Garrett SQL-backed indices can only use tables and columns, not method names - hence why the generated SQL is not quite right. (Real-time indices, on the other hand, are the opposite, hence that worked then). You'll need to refer through associations to the columns and TS will ensure they're aggregated in the SQL query itself.
Also: TS always provides column aliases, just from a consistency perspective :) Cheers -- Pat On 17 Apr 2014, at 11:53 pm, Garrett Dimon <[email protected]> wrote: > We ran into some bumps deploying RT indexing, so we're stepping back to > upgrade TS separately, and still lean on delayed deltas in the short-term and > switching over to RT separately. > > In retro-fitting our updated code, it seems that the config file is being > generated differently: > > The beginning of our index looks like... > > ThinkingSphinx::Index.define(:issue, :with => :active_record, :delta => > ThinkingSphinx::Deltas::DelayedDelta) do > indexes subject, sortable: true > indexes :comment_bodies > indexes :attachment_file_names > > And, the resulting SQL_QUERY in the sphinx.conf looks like... > > sql_query = SELECT SQL_NO_CACHE `issues`.`id` * 3 + 0 AS `id`, > `issues`.`subject` AS `subject`, AS `comment_bodies`, AS > `attachment_file_names`, > > So, it seems like the SQL being generated for our custom "comment_bodies" and > "attachment_file_names" is setting it up like an "AS" clause without the > original name. This is curious on two fronts: > > 1. Those are model attributes that gather the data into a single string for > indexing purposes. So I wouldn't expect them to be in the SQL like that. > (Although, I'm guessing this may be related to the SphinxQL.) > 2. It's interesting that it's using an AS rather than just the "field" names > directly. > > When we were using RT indexing, the indexes for comment_bodies and > attachment_file_names worked with that syntax in our index. Is it possible > that using delayed deltas is generating a different config file? (I wouldn't > think so, but that's the only significant change from our previous setup with > RT.) > > Thanks, > Garrett > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/thinking-sphinx. > For more options, visit 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/thinking-sphinx. For more options, visit https://groups.google.com/d/optout.
